|
黄彦熹 (AK-203)
|
1ms |
280 KiB |
|
195 Bytes |
2023-2-26 19:52:27 |
|
罗兰(漆黑襟默) (zhangxiaoci)
|
1ms |
384 KiB |
|
208 Bytes |
2023-4-29 15:13:09 |
|
李树崑 (lishukun)
|
1ms |
384 KiB |
|
286 Bytes |
2022-8-21 12:13:14 |
|
444444444 (唐跃元)
|
1ms |
384 KiB |
|
221 Bytes |
2023-4-29 15:06:10 |
|
我是周靖松长得帅 (mouyunqi)
|
1ms |
384 KiB |
|
177 Bytes |
2023-4-29 14:32:34 |
|
kcs007
|
1ms |
384 KiB |
|
198 Bytes |
2023-4-29 15:11:29 |
|
肖添宇
|
1ms |
384 KiB |
|
243 Bytes |
2022-4-23 17:35:18 |
|
手搓STL stack 双向无环链表 _ 向量 2种实现方式: template <typename Map_Type> class Stack_l /* Stack _ List */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }Data; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }; public: unsigned int size(void) { return Data.List_Size; } Map_Type& top(void) { return Data.endp -> Node_Data; } void* data(void) { return &Data; } bool empty(void) { return !((bool)Data.headp); } Stack_l<Map_Type>& push(Map_Type push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type& push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& push(const Map_Type* push_data) { Node *nodep = new Node(); nodep -> lastp = Data.endp; if (!Data.headp) { Data.headp = nodep; Data.endp = nodep; } else Data.endp -> nextp = nodep; Data.endp = nodep; nodep -> Node_Data = *(Map_Type*)push_data; ++Data.List_Size; return *this; } Stack_l<Map_Type>& pop(void) { if (Data.headp) { if (Data.List_Size == 1u) { delete Data.headp; Data.List_Size = 0; Data.headp = 0; Data.endp = 0; } else { Data.endp = Data.endp -> lastp; delete Data.endp -> nextp; Data.endp -> nextp = 0; --Data.List_Size; } } return *this; } Stack_l<Map_Type>& clear(void) { while (Data.List_Size) { pop(); } return *this; } Stack_l<Map_Type>(void) { /* NULL */ } Stack_l<Map_Type>(unsigned int data_size, Map_Type map_data) { Data.List_Size = data_size; while (data_size--) { Node *nodep = new Node(); nodep -> Node_Data = map_data; if (Data.headp) { nodep -> lastp = Data.endp; Data.endp -> nextp = nodep; Data.endp = nodep; } else { Data.headp = nodep; Data.endp = nodep; } } } Stack_l<Map_Type>(Stack_l<Map_Type>& map_data) { if (!map_data.empty()) { List_Data *listp = (List_Data*)map_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; } } Stack_l<Map_Type>& operator=(Stack_l<Map_Type>& copy_data) { if (copy_data.empty()) return *this; List_Data *listp = (List_Data*)copy_data.data(); Node *nodep = listp -> headp, *newp; for (unsigned int i = 0; i != listp -> List_Size; ++i, nodep = nodep -> nextp) { newp = new Node(); newp -> Node_Data = nodep -> Node_Data; if (Data.headp) { newp -> lastp = Data.endp; Data.endp -> nextp = newp; Data.endp = newp; } else { Data.headp = newp; Data.endp = newp; } } Data.List_Size = listp -> List_Size; return *this; } bool operator==(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() != Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return true; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return false; } return true; } bool operator!=(Stack_l<Map_Type>& cmp_data) { if (cmp_data.size() == Data.List_Size) return false; else if (cmp_data.empty() && (!Data.List_Size)) return false; Node *nodep1 = Data.headp, *nodep2 = ((List_Data*)cmp_data.data()) ->headp; for (unsigned int i = 0; i != Data.List_Size; ++i, nodep1 = nodep1 -> nextp, nodep2 = nodep2 ->nextp) { if (nodep1 -> Node_Data != nodep2 -> Node_Data) return true; } return true; } ~Stack_l<Map_Type>(void) { clear(); } }; /* Stack _ List */ template <typename Map_Type> class Stack_v /* Stack _ Vector */ { private: struct Node { Map_Type Node_Data; Node *nextp, *lastp; Node(void) { nextp = 0; lastp = 0; } }; struct List_Data { unsigned int List_Size; Node *headp, *endp; List_Data(void) { List_Size = 0; headp = 0; endp = 0; } }; struct Vector_Data { Map_Type *headp, *lastp, *endp; void resize(unsigned int data_size) { Map_Type *newp = new Map_Type[data_size](); endp = newp + data_size - 1; lastp = newp + (data_size > lastp - headp ? lastp - headp : data_size); if (headp) delete[] headp; headp = newp; } Vector_Data(void) { headp = 0; lastp = 0; endp = 0; } }Data; public: unsigned int size(void) { return Data.lastp - Data.headp; } Map_Type& top(void) { return *(Data.lastp - 1); } void* data(void) { return &Data; } bool full(void) { if (!Data.headp) return true; return Data.endp + 1 == Data.lastp; } bool empty(void) { if (!Data.headp) return true; return Data.headp == Data.lastp; } Stack_v<Map_Type>& push(Map_Type push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type& push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& push(const Map_Type* push_data) { if (full()) Data.resize((unsigned int)((Data.lastp - Data.headp) * 1.5) + 1); *Data.lastp = *(Map_Type*)push_data; ++Data.lastp; return *this; } Stack_v<Map_Type>& pop(void) { if (empty()) { if (Data.lastp - Data.headp > 1) Data.resize((Data.lastp - Data.headp) >> 1); else return *this; } else --Data.lastp; return *this; } Stack_v<Map_Type>(void) { /* NULL */ } Stack_v<Map_Type>(unsigned int data_size, Map_Type map_data) { while (data_size) { push(&map_data); --data_size; } } Stack_v<Map_Type>(Stack_v<Map_Type>& map_data) { Vector_Data *datap = (Vector_Data*)map_data.data(); for (unsigned int i = 0, k = map_data.size(); i != k; ++i) push(datap -> headp + i); } Stack_v<Map_Type>& operator=(Stack_v<Map_Type>& copy_data) { if (copy_data.empty()) clear(); else { Vector_Data *datap = (Vector_Data*)copy_data.data(); for (unsigned int i = 0, k = copy_data.size(); i != k; ++i) push(datap -> headp + i); } return *this; } bool operator==(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return false; else if (empty() && cmp_data.empty()) return true; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap ->headp + i)) return false; } return true; } bool operator!=(Stack_v<Map_Type>& cmp_data) { if (size() != cmp_data.size()) return true; else if (empty() && cmp_data.empty()) return false; Vector_Data *datap = (Vector_Data*)cmp_data.data(); for (unsigned int i = 0, k = size(); i != k; ++i) { if (*(Data.headp + i) != *(datap -> headp + i)) return true; } return false; } Stack_v<Map_Type>& clear(void) { delete[] Data.headp; Data.headp = 0; Data.lastp = 0; Data.endp = 0; return *this; } ~Stack_v<Map_Type>(void) { delete[] Data.headp; } }; /* Stack _ Vector */ int main(void) { return 0; } (22029-xys)
|
1ms |
392 KiB |
|
184 Bytes |
2023-5-25 20:25:47 |
|
张子轩 (zhangzixuana)
|
1ms |
384 KiB |
|
387 Bytes |
2023-5-3 13:59:27 |
|
曹埊睿 (caodirui)
|
1ms |
384 KiB |
|
84 Bytes |
2023-4-15 23:16:10 |
|
周靖松 (ZhouJS)
|
1ms |
384 KiB |
|
171 Bytes |
2023-4-29 15:09:20 |
|
张子轩 (zhangzixuana)
|
1ms |
384 KiB |
|
184 Bytes |
2023-4-29 14:40:32 |
|
芒苒忧 (廖迦南)
|
1ms |
416 KiB |
|
299 Bytes |
2022-7-20 9:08:46 |
|
樊竣熠 (lft1114)
|
1ms |
424 KiB |
|
277 Bytes |
2022-8-19 15:24:58 |
|
ywh
|
1ms |
384 KiB |
|
189 Bytes |
2022-7-8 10:16:23 |
|
Alduin
|
1ms |
384 KiB |
|
292 Bytes |
2022-2-19 10:13:00 |
|
赵泳鑫 (zhaoyongxin)
|
1ms |
336 KiB |
|
231 Bytes |
2022-7-12 14:36:24 |
|
renqiumo
|
1ms |
384 KiB |
|
395 Bytes |
2022-11-13 13:47:45 |
|
张子轩 (zhangzixuana)
|
1ms |
392 KiB |
|
184 Bytes |
2023-5-3 14:00:03 |
|
赵泳鑫 (zhaoyongxin)
|
1ms |
384 KiB |
|
231 Bytes |
2022-7-12 14:36:23 |
|
朱老师 (zyp)
|
1ms |
432 KiB |
|
197 Bytes |
2022-8-21 11:04:25 |
|
zhuziyu
|
1ms |
392 KiB |
|
195 Bytes |
2022-2-19 10:12:11 |
|
时代二校+王吕棪 (wanglvyan)
|
1ms |
428 KiB |
|
235 Bytes |
2023-5-15 21:05:31 |
|
金沙校区-蓝祥与 (蓝祥与)
|
1ms |
384 KiB |
|
218 Bytes |
2023-4-29 15:13:08 |
|
冒牌陈杰晟【MOD】 (wed)
|
1ms |
432 KiB |
|
150 Bytes |
2022-3-5 10:24:46 |
|
姚宏逸
|
1ms |
444 KiB |
|
632 Bytes |
2022-3-15 10:39:41 |
|
yuhaodi
|
1ms |
440 KiB |
|
246 Bytes |
2023-5-7 9:11:55 |
|
MoonLight ( aaa)
|
1ms |
428 KiB |
|
152 Bytes |
2022-4-28 20:59:35 |
|
luoluonuoya
|
1ms |
424 KiB |
|
199 Bytes |
2022-8-12 15:56:45 |
|
我是周靖松长得帅 (mouyunqi)
|
1ms |
436 KiB |
|
177 Bytes |
2023-4-29 14:32:16 |
|
陈杰晟
|
1ms |
424 KiB |
|
203 Bytes |
2022-4-10 13:50:37 |
|
疯神芭芭脱丝 (李卓修)
|
1ms |
424 KiB |
|
172 Bytes |
2022-7-14 17:17:01 |
|
21035-wyf
|
2ms |
428 KiB |
|
220 Bytes |
2022-2-27 20:28:57 |
|
huyinuo
|
2ms |
436 KiB |
|
269 Bytes |
2022-4-13 20:54:18 |
|
王晨志 (wangchenzhi)
|
2ms |
512 KiB |
|
261 Bytes |
2022-6-19 13:23:10 |
|
杜俊宏
|
2ms |
436 KiB |
|
196 Bytes |
2022-6-25 9:32:12 |
|
LUKHE (LukeHu)
|
2ms |
432 KiB |
|
226 Bytes |
2022-2-20 14:01:07 |
|
彭嘉豪 (pengjiahao)
|
2ms |
384 KiB |
|
208 Bytes |
2023-3-16 21:23:03 |
|
SYC0226
|
2ms |
432 KiB |
|
208 Bytes |
2022-10-3 10:46:10 |
|
zlx (xiao)
|
2ms |
444 KiB |
|
237 Bytes |
2022-11-26 19:12:36 |
|
Randy Marsh (杨子腾)
|
2ms |
436 KiB |
|
214 Bytes |
2023-1-13 14:44:12 |
|
龙湖时代C馆-邹镇宇 (邹镇宇)
|
2ms |
416 KiB |
|
184 Bytes |
2022-9-7 19:23:42 |
|
(张洛诚)
|
2ms |
440 KiB |
|
276 Bytes |
2023-5-4 20:44:44 |
|
汪致卉 (wangzh)
|
17ms |
4 MiB |
Python 3 |
25 Bytes |
2022-7-28 8:22:27 |
|
潘胤宸
|
17ms |
3.8 MiB |
Python 3 |
62 Bytes |
2023-1-8 15:17:59 |
|
潘胤羲
|
18ms |
4 MiB |
Python 3 |
70 Bytes |
2023-1-8 15:17:35 |
|
老六在此
|
25ms |
6.6 MiB |
C++20 |
215 Bytes |
2024-7-25 12:16:09 |
|
徐瑀阳
|
25ms |
6.6 MiB |
C++98 |
232 Bytes |
2024-7-28 11:06:08 |
|
时代2校-程俊燃 (chengjunran)
|
25ms |
6.6 MiB |
C++11 |
223 Bytes |
2024-7-11 12:09:10 |
|
Yuan (Zongzi1)
|
26ms |
6.6 MiB |
C++17(O2) |
198 Bytes |
2024-7-21 23:33:50 |
|
xmw318046
|
26ms |
6.7 MiB |
C++98 |
220 Bytes |
2024-7-13 12:44:16 |
|
阮 (媚狐不吃道旁李)
|
26ms |
7.2 MiB |
C++98 |
227 Bytes |
2024-5-2 16:47:14 |
|
wangzihang
|
26ms |
6.6 MiB |
C++98 |
290 Bytes |
2024-7-12 14:14:40 |
|
希蒙 (zhengxingya)
|
28ms |
7.2 MiB |
|
287 Bytes |
2023-11-11 11:13:22 |
|
zyl
|
28ms |
7.1 MiB |
|
208 Bytes |
2024-1-22 9:49:49 |
|
周琪渃
|
29ms |
6.9 MiB |
|
172 Bytes |
2023-7-27 15:32:15 |
|
邹曜丞 (13983097018)
|
29ms |
6.7 MiB |
|
187 Bytes |
2023-8-26 18:06:26 |
|
欧俊阳
|
29ms |
7 MiB |
|
236 Bytes |
2023-8-21 13:39:51 |
|
jighghjkfkhfdhdfdfdsfsdfsafvmnkbnkbmnlvnmkbvnvb;,.m;,;.;,;kbvlmkbnlmkblnvkmlbnkmlbvkmlbvklmbkmlkblmbnm;,l.,.;,'.,';.[',;.[,kjkoihgfhfgiohifgohifgohiofgihgofhiofgihofgihofgihofgiho;''[;.',m;.',m.;',.;'m,.;';'cv;x'cb'cx;b'cv;b'xc;b'c;b'cvbvc.'bv.//,/vb./vcb./cvbv,c.b,cv.,b.cv,b.vc,bg;hgl;hgl;hg;h;hfg;hl;lf;l;lxc;cln;bvln;vcln;vnl;vbl;vbln;vlv;blnvb;plnp;lplhfljpjh;nlvb;nv;bn;vcvl;nlv;nlv;g;hjhchl;ghfghl;fghl;ltlh;l;hlf;lg;bnlc;;nlv;nbv;nbv;nvb;nlvcnl;xc;blxcb;ll;hg;lhgl;dfl;t;ldy;l;lyl;rewlt493;l;dl;dsflg;lsdlpbpcxobpocvbpopopopreopotpreotertertretert (litingxu)
|
30ms |
6.7 MiB |
|
263 Bytes |
2023-8-24 15:03:05 |
|
黄梓轩 (huangzixuan)
|
30ms |
6.7 MiB |
|
185 Bytes |
2023-9-17 13:22:23 |
|
RanHao
|
31ms |
7.1 MiB |
|
222 Bytes |
2023-7-15 16:06:29 |
|
Jose (反恐皮蛋)
|
32ms |
6.9 MiB |
C++98 |
378 Bytes |
2024-7-3 14:05:25 |
|
Tender. (05c05-zhou)
|
34ms |
6.7 MiB |
|
222 Bytes |
2023-8-24 10:54:40 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
38ms |
6.7 MiB |
|
465 Bytes |
2023-8-23 13:21:40 |
|
爱琴海校区-刁钲洋 (刁钲洋)
|
38ms |
6.7 MiB |
|
465 Bytes |
2023-8-23 13:21:13 |
|
colin1112 (墙凌可)
|
126ms |
552 KiB |
C++14(O2) |
254 Bytes |
2024-10-5 10:52:44 |
|
AAA? Prow max (hechenxuan23005)
|
134ms |
764 KiB |
C++20(O2) |
110 Bytes |
2024-9-20 19:41:03 |
|
jdy
|
135ms |
768 KiB |
|
180 Bytes |
2024-3-10 14:44:59 |
|
明轩 (吕同学)
|
136ms |
764 KiB |
C++14(O2) |
459 Bytes |
2024-11-16 17:50:17 |
|
赵奕铭
|
138ms |
764 KiB |
|
189 Bytes |
2024-3-14 12:52:24 |
|
Sivan
|
140ms |
764 KiB |
C++98(O2) |
177 Bytes |
2024-9-10 15:08:53 |
|
zzzrrrxxx
|
140ms |
772 KiB |
|
174 Bytes |
2024-4-4 9:56:45 |
|
凌胥桐1
|
141ms |
764 KiB |
C++98 |
203 Bytes |
2024-11-1 18:34:20 |
|
罗元邑2
|
141ms |
540 KiB |
C++98(O2) |
423 Bytes |
2024-9-3 9:23:48 |
|
A小涂
|
142ms |
544 KiB |
C++17 |
204 Bytes |
2024-10-8 18:13:20 |
|
小忙果 (王昱杰)
|
143ms |
764 KiB |
C++14(O2) |
229 Bytes |
2024-10-19 10:39:03 |
|
My name is Man (钟卓劭)
|
143ms |
544 KiB |
C++98 |
181 Bytes |
2024-9-15 13:38:00 |
|
古煦涵
|
143ms |
768 KiB |
C++98 |
167 Bytes |
2024-9-20 21:04:20 |
|
邓皓文 (min_element)
|
152ms |
768 KiB |
C++98(O2) |
247 Bytes |
2024-10-25 20:38:22 |
|
kongql
|
372ms |
8.9 MiB |
Python 3 |
72 Bytes |
2023-7-27 19:23:57 |