problemscpp
A collection of my answers to algorithm problems in c++.
acwing408_test.cpp
浏览该文件的文档.
1//
2// Created by tategotoazarasi on 24-5-7.
3//
4#include "acwing408.h"
5#include "gtest/gtest.h"
6
7namespace acwing {
8 namespace acwing3378 {
9 TEST(acwing3378, case1) {
10 istringstream in("4\n"
11 "0\n"
12 "jack 70\n"
13 "peter 96\n"
14 "Tom 70\n"
15 "smith 67");
16 auto out = ostringstream();
17 main(in, out);
18 const auto ans = out.str();
19 ASSERT_EQ("peter 96\n"
20 "jack 70\n"
21 "Tom 70\n"
22 "smith 67\n",
23 ans);
24 }
25
26 TEST(acwing3378, case2) {
27 istringstream in("4\n"
28 "1\n"
29 "jack 70\n"
30 "peter 96\n"
31 "Tom 70\n"
32 "smith 67");
33 auto out = ostringstream();
34 main(in, out);
35 const auto ans = out.str();
36 ASSERT_EQ("smith 67\n"
37 "jack 70\n"
38 "Tom 70\n"
39 "peter 96\n",
40 ans);
41 }
42
43 TEST(acwing3378, case3) {
44 istringstream in("100\n"
45 "0\n"
46 "ueuauw 39\n"
47 "rhntqphmbc 50\n"
48 "gwe 94\n"
49 "gxym 99\n"
50 "z 48\n"
51 "ccugwbcyu 22\n"
52 "qeo 25\n"
53 "veqb 25\n"
54 "fecl 23\n"
55 "jkakocou 6\n"
56 "zjf 17\n"
57 "wmjflfg 68\n"
58 "qijg 3\n"
59 "euiuxavbzx 75\n"
60 "cnnpbsdknk 8\n"
61 "xzm 50\n"
62 "zkkteb 34\n"
63 "dnmmp 40\n"
64 "pqbqshzbw 69\n"
65 "j 5\n"
66 "owqpleza 81\n"
67 "zxmbfhd 40\n"
68 "efhufcak 71\n"
69 "ih 15\n"
70 "tle 12\n"
71 "hahmeo 17\n"
72 "fpaqh 57\n"
73 "jgaymzbbe 77\n"
74 "lg 42\n"
75 "olfyjwvao 35\n"
76 "ytrrfqpqal 62\n"
77 "ypdz 34\n"
78 "eiiplejnht 83\n"
79 "lcjwld 56\n"
80 "lrktzp 71\n"
81 "zxbmu 56\n"
82 "ayqeet 76\n"
83 "okkarfg 93\n"
84 "qg 54\n"
85 "qnncyeab 62\n"
86 "ufokdpji 58\n"
87 "y 71\n"
88 "seycf 76\n"
89 "oeuur 100\n"
90 "iegnj 26\n"
91 "wejcgx 62\n"
92 "zbq 91\n"
93 "weil 71\n"
94 "mnmjdsbonc 93\n"
95 "wtwogwzv 51\n"
96 "opf 76\n"
97 "y 99\n"
98 "rcor 61\n"
99 "pkcvneh 68\n"
100 "ieuk 27\n"
101 "sbygxeeot 9\n"
102 "bywjbi 96\n"
103 "ngaqiie 38\n"
104 "moypf 19\n"
105 "ocvgzccuwm 2\n"
106 "zmxwoohbx 65\n"
107 "uq 20\n"
108 "rwyay 100\n"
109 "ecl 73\n"
110 "sxzuc 17\n"
111 "g 96\n"
112 "sbhwwec 2\n"
113 "xladpyjbh 72\n"
114 "dumtwkm 54\n"
115 "dganarbzg 1\n"
116 "kplbvgbfm 52\n"
117 "xznewvj 74\n"
118 "qxxoftmvy 26\n"
119 "btgs 100\n"
120 "ebpb 59\n"
121 "rzcjegvaik 19\n"
122 "c 31\n"
123 "sufabvfhu 26\n"
124 "y 39\n"
125 "hzwcluebji 15\n"
126 "pleyhlspye 10\n"
127 "himeyqc 2\n"
128 "uldwmrr 3\n"
129 "aqroavrgal 30\n"
130 "niwkcqpx 79\n"
131 "idybglq 57\n"
132 "cobjitjud 11\n"
133 "wijxnamzgm 55\n"
134 "lujjwqmf 11\n"
135 "mqmemhrlxs 59\n"
136 "e 47\n"
137 "oktlvt 46\n"
138 "l 40\n"
139 "mwjhpryut 7\n"
140 "s 85\n"
141 "s 73\n"
142 "jqf 33\n"
143 "yjkvuxrlq 1\n"
144 "ibme 99\n"
145 "wr 69");
146 auto out = ostringstream();
147 main(in, out);
148 const auto ans = out.str();
149 ASSERT_EQ("oeuur 100\n"
150 "rwyay 100\n"
151 "btgs 100\n"
152 "gxym 99\n"
153 "y 99\n"
154 "ibme 99\n"
155 "bywjbi 96\n"
156 "g 96\n"
157 "gwe 94\n"
158 "okkarfg 93\n"
159 "mnmjdsbonc 93\n"
160 "zbq 91\n"
161 "s 85\n"
162 "eiiplejnht 83\n"
163 "owqpleza 81\n"
164 "niwkcqpx 79\n"
165 "jgaymzbbe 77\n"
166 "ayqeet 76\n"
167 "seycf 76\n"
168 "opf 76\n"
169 "euiuxavbzx 75\n"
170 "xznewvj 74\n"
171 "ecl 73\n"
172 "s 73\n"
173 "xladpyjbh 72\n"
174 "efhufcak 71\n"
175 "lrktzp 71\n"
176 "y 71\n"
177 "weil 71\n"
178 "pqbqshzbw 69\n"
179 "wr 69\n"
180 "wmjflfg 68\n"
181 "pkcvneh 68\n"
182 "zmxwoohbx 65\n"
183 "ytrrfqpqal 62\n"
184 "qnncyeab 62\n"
185 "wejcgx 62\n"
186 "rcor 61\n"
187 "ebpb 59\n"
188 "mqmemhrlxs 59\n"
189 "ufokdpji 58\n"
190 "fpaqh 57\n"
191 "idybglq 57\n"
192 "lcjwld 56\n"
193 "zxbmu 56\n"
194 "wijxnamzgm 55\n"
195 "qg 54\n"
196 "dumtwkm 54\n"
197 "kplbvgbfm 52\n"
198 "wtwogwzv 51\n"
199 "rhntqphmbc 50\n"
200 "xzm 50\n"
201 "z 48\n"
202 "e 47\n"
203 "oktlvt 46\n"
204 "lg 42\n"
205 "dnmmp 40\n"
206 "zxmbfhd 40\n"
207 "l 40\n"
208 "ueuauw 39\n"
209 "y 39\n"
210 "ngaqiie 38\n"
211 "olfyjwvao 35\n"
212 "zkkteb 34\n"
213 "ypdz 34\n"
214 "jqf 33\n"
215 "c 31\n"
216 "aqroavrgal 30\n"
217 "ieuk 27\n"
218 "iegnj 26\n"
219 "qxxoftmvy 26\n"
220 "sufabvfhu 26\n"
221 "qeo 25\n"
222 "veqb 25\n"
223 "fecl 23\n"
224 "ccugwbcyu 22\n"
225 "uq 20\n"
226 "moypf 19\n"
227 "rzcjegvaik 19\n"
228 "zjf 17\n"
229 "hahmeo 17\n"
230 "sxzuc 17\n"
231 "ih 15\n"
232 "hzwcluebji 15\n"
233 "tle 12\n"
234 "cobjitjud 11\n"
235 "lujjwqmf 11\n"
236 "pleyhlspye 10\n"
237 "sbygxeeot 9\n"
238 "cnnpbsdknk 8\n"
239 "mwjhpryut 7\n"
240 "jkakocou 6\n"
241 "j 5\n"
242 "qijg 3\n"
243 "uldwmrr 3\n"
244 "ocvgzccuwm 2\n"
245 "sbhwwec 2\n"
246 "himeyqc 2\n"
247 "dganarbzg 1\n"
248 "yjkvuxrlq 1\n",
249 ans);
250 }
251
252 TEST(acwing3378, case4) {
253 istringstream in("100\n"
254 "0\n"
255 "eitqx 37\n"
256 "gpnwh 96\n"
257 "gre 7\n"
258 "t 89\n"
259 "axgt 77\n"
260 "bedfrq 14\n"
261 "wibtck 81\n"
262 "uvi 95\n"
263 "fjik 37\n"
264 "apv 85\n"
265 "tzyame 55\n"
266 "avfqpdgj 29\n"
267 "mgkerlanxu 92\n"
268 "kip 77\n"
269 "n 30\n"
270 "ovcaijgoal 95\n"
271 "schkm 14\n"
272 "huga 98\n"
273 "bvvtz 74\n"
274 "ba 39\n"
275 "ean 75\n"
276 "w 100\n"
277 "gjtoystw 60\n"
278 "mcp 27\n"
279 "yanohhiahb 68\n"
280 "vuo 14\n"
281 "hxengkhcog 81\n"
282 "z 33\n"
283 "dfhgyfk 16\n"
284 "rioeptytq 44\n"
285 "tsx 15\n"
286 "mwusnru 40\n"
287 "nne 60\n"
288 "xg 71\n"
289 "yqoyso 48\n"
290 "azpfhcl 98\n"
291 "swn 26\n"
292 "u 70\n"
293 "srjgvxxh 26\n"
294 "blyob 4\n"
295 "qcbnyndvpc 67\n"
296 "trhsghq 68\n"
297 "edbnpcg 64\n"
298 "vretjhkq 46\n"
299 "h 32\n"
300 "bujfbsbvkx 85\n"
301 "z 49\n"
302 "itepoq 18\n"
303 "namavupy 87\n"
304 "wbfr 46\n"
305 "zw 27\n"
306 "v 6\n"
307 "lhpqsssir 56\n"
308 "c 7\n"
309 "g 12\n"
310 "i 11\n"
311 "jj 85\n"
312 "zicwxfsf 71\n"
313 "yyedh 19\n"
314 "sblizpeey 60\n"
315 "bcwqcv 42\n"
316 "w 94\n"
317 "zlvs 78\n"
318 "olwszucmf 64\n"
319 "qlhtvus 79\n"
320 "nbnyavymi 23\n"
321 "lqzlapfyu 92\n"
322 "qtpznd 30\n"
323 "t 85\n"
324 "xhh 38\n"
325 "iaxsj 64\n"
326 "ycwmbpja 92\n"
327 "d 99\n"
328 "unt 88\n"
329 "fzmzqw 89\n"
330 "aakxmwzb 51\n"
331 "km 95\n"
332 "kzjhr 79\n"
333 "mrrz 80\n"
334 "yiwp 66\n"
335 "zlwlwbnz 35\n"
336 "laexmop 61\n"
337 "rao 65\n"
338 "k 76\n"
339 "qupfnwemav 93\n"
340 "er 20\n"
341 "xoltw 30\n"
342 "xxnnylhmr 81\n"
343 "o 66\n"
344 "hnwdhujn 73\n"
345 "zwjkxq 14\n"
346 "ejibwqo 22\n"
347 "d 20\n"
348 "imshoxcv 93\n"
349 "axygtftzrq 65\n"
350 "p 53\n"
351 "lrzhstv 54\n"
352 "lezed 51\n"
353 "hs 64\n"
354 "gz 52");
355 auto out = ostringstream();
356 main(in, out);
357 const auto ans = out.str();
358 ASSERT_EQ("w 100\n"
359 "d 99\n"
360 "huga 98\n"
361 "azpfhcl 98\n"
362 "gpnwh 96\n"
363 "uvi 95\n"
364 "ovcaijgoal 95\n"
365 "km 95\n"
366 "w 94\n"
367 "qupfnwemav 93\n"
368 "imshoxcv 93\n"
369 "mgkerlanxu 92\n"
370 "lqzlapfyu 92\n"
371 "ycwmbpja 92\n"
372 "t 89\n"
373 "fzmzqw 89\n"
374 "unt 88\n"
375 "namavupy 87\n"
376 "apv 85\n"
377 "bujfbsbvkx 85\n"
378 "jj 85\n"
379 "t 85\n"
380 "wibtck 81\n"
381 "hxengkhcog 81\n"
382 "xxnnylhmr 81\n"
383 "mrrz 80\n"
384 "qlhtvus 79\n"
385 "kzjhr 79\n"
386 "zlvs 78\n"
387 "axgt 77\n"
388 "kip 77\n"
389 "k 76\n"
390 "ean 75\n"
391 "bvvtz 74\n"
392 "hnwdhujn 73\n"
393 "xg 71\n"
394 "zicwxfsf 71\n"
395 "u 70\n"
396 "yanohhiahb 68\n"
397 "trhsghq 68\n"
398 "qcbnyndvpc 67\n"
399 "yiwp 66\n"
400 "o 66\n"
401 "rao 65\n"
402 "axygtftzrq 65\n"
403 "edbnpcg 64\n"
404 "olwszucmf 64\n"
405 "iaxsj 64\n"
406 "hs 64\n"
407 "laexmop 61\n"
408 "gjtoystw 60\n"
409 "nne 60\n"
410 "sblizpeey 60\n"
411 "lhpqsssir 56\n"
412 "tzyame 55\n"
413 "lrzhstv 54\n"
414 "p 53\n"
415 "gz 52\n"
416 "aakxmwzb 51\n"
417 "lezed 51\n"
418 "z 49\n"
419 "yqoyso 48\n"
420 "vretjhkq 46\n"
421 "wbfr 46\n"
422 "rioeptytq 44\n"
423 "bcwqcv 42\n"
424 "mwusnru 40\n"
425 "ba 39\n"
426 "xhh 38\n"
427 "eitqx 37\n"
428 "fjik 37\n"
429 "zlwlwbnz 35\n"
430 "z 33\n"
431 "h 32\n"
432 "n 30\n"
433 "qtpznd 30\n"
434 "xoltw 30\n"
435 "avfqpdgj 29\n"
436 "mcp 27\n"
437 "zw 27\n"
438 "swn 26\n"
439 "srjgvxxh 26\n"
440 "nbnyavymi 23\n"
441 "ejibwqo 22\n"
442 "er 20\n"
443 "d 20\n"
444 "yyedh 19\n"
445 "itepoq 18\n"
446 "dfhgyfk 16\n"
447 "tsx 15\n"
448 "bedfrq 14\n"
449 "schkm 14\n"
450 "vuo 14\n"
451 "zwjkxq 14\n"
452 "g 12\n"
453 "i 11\n"
454 "gre 7\n"
455 "c 7\n"
456 "v 6\n"
457 "blyob 4\n",
458 ans);
459 }
460 }// namespace acwing3378
461
462 namespace acwing3376 {
463 TEST(acwing3376, case1) {
464 istringstream in("3\n"
465 "1 90\n"
466 "2 87\n"
467 "3 92");
468 auto out = ostringstream();
469 main(in, out);
470 const auto ans = out.str();
471 ASSERT_EQ("2 87\n"
472 "1 90\n"
473 "3 92\n",
474 ans);
475 }
476 }// namespace acwing3376
477
478 namespace acwing3374 {
479 TEST(acwing3374, case1) {
480 istringstream in("10 2\n"
481 "11");
482 auto out = ostringstream();
483 main(in, out);
484 const auto ans = out.str();
485 ASSERT_EQ("1011",
486 ans);
487 }
488
489 TEST(acwing3374, case2) {
490 istringstream in("33 32\n"
491 "8MJ8REPCCDS646V91FU5");
492 auto out = ostringstream();
493 main(in, out);
494 const auto ans = out.str();
495 ASSERT_EQ("fil22vqticlaaeabeme7",
496 ans);
497 }
498 }// namespace acwing3374
499
500 namespace acwing3757 {
501 TEST(acwing3757, case1) {
502 auto head = new ListNode{1,
503 new ListNode{2,
504 new ListNode{3,
505 new ListNode{4, nullptr}}}};
506 rearrangedList(head);
507 ASSERT_EQ(1, head->val);
508 ASSERT_EQ(4, head->next->val);
509 ASSERT_EQ(2, head->next->next->val);
510 ASSERT_EQ(3, head->next->next->next->val);
511 delete head->next->next->next;
512 delete head->next->next;
513 delete head->next;
514 delete head;
515 }
516
517 TEST(acwing3757, case2) {
518 auto head = new ListNode{1,
519 new ListNode{2,
520 new ListNode{3,
521 new ListNode{4,
522 new ListNode{5, nullptr}}}}};
523 rearrangedList(head);
524 ASSERT_EQ(1, head->val);
525 ASSERT_EQ(5, head->next->val);
526 ASSERT_EQ(2, head->next->next->val);
527 ASSERT_EQ(4, head->next->next->next->val);
528 ASSERT_EQ(3, head->next->next->next->next->val);
529 delete head->next->next->next->next;
530 delete head->next->next->next;
531 delete head->next->next;
532 delete head->next;
533 delete head;
534 }
535 }// namespace acwing3757
536
537 namespace acwing3607 {
538 TEST(acwing3607, case1) {
539 istringstream in("2000 3\n"
540 "2000 31\n"
541 "2000 40\n"
542 "2000 60\n"
543 "2000 61\n"
544 "2001 60");
545 auto out = ostringstream();
546 main(in, out);
547 const auto ans = out.str();
548 ASSERT_EQ("2000-01-03\n"
549 "2000-01-31\n"
550 "2000-02-09\n"
551 "2000-02-29\n"
552 "2000-03-01\n"
553 "2001-03-01\n",
554 ans);
555 }
556
557 TEST(acwing3607, case2) {
558 istringstream in("2000 3\n"
559 "2000 31\n"
560 "2000 40\n"
561 "2000 60\n"
562 "2000 366\n"
563 "2001 60\n"
564 "2004 366\n"
565 "1900 365");
566 auto out = ostringstream();
567 main(in, out);
568 const auto ans = out.str();
569 ASSERT_EQ("2000-01-03\n"
570 "2000-01-31\n"
571 "2000-02-09\n"
572 "2000-02-29\n"
573 "2000-12-31\n"
574 "2001-03-01\n"
575 "2004-12-31\n"
576 "1900-12-31\n",
577 ans);
578 }
579 }// namespace acwing3607
580
581 namespace acwing3573 {
582 TEST(acwing3573, case1) {
583 istringstream in("1\n"
584 "2008 2 3 100");
585 auto out = ostringstream();
586 main(in, out);
587 const auto ans = out.str();
588 ASSERT_EQ("2008-05-13\n",
589 ans);
590 }
591
592 TEST(acwing3573, case2) {
593 istringstream in("154\n"
594 "1940 8 14 88\n"
595 "2261 4 14 67\n"
596 "2181 5 20 55\n"
597 "1321 1 11 65\n"
598 "1817 9 20 16\n"
599 "2027 4 28 46\n"
600 "1890 10 16 92\n"
601 "2913 2 21 22\n"
602 "1784 9 1 67\n"
603 "2921 11 29 19\n"
604 "2846 7 28 87\n"
605 "2906 12 20 81\n"
606 "1761 11 20 53\n"
607 "1537 12 10 83\n"
608 "2645 5 14 63\n"
609 "1973 12 30 36\n"
610 "2604 2 23 19\n"
611 "2925 10 26 16\n"
612 "2188 8 14 95\n"
613 "1722 12 21 44\n"
614 "2124 9 2 81\n"
615 "2950 9 16 1\n"
616 "2742 9 20 5\n"
617 "2144 1 6 22\n"
618 "2666 5 12 83\n"
619 "1051 1 17 5\n"
620 "2327 4 5 23\n"
621 "1846 9 18 54\n"
622 "2615 4 18 7\n"
623 "1024 4 9 74\n"
624 "1048 3 9 58\n"
625 "1977 7 25 79\n"
626 "1339 9 26 65\n"
627 "1315 6 19 62\n"
628 "1403 7 27 19\n"
629 "1986 11 1 97\n"
630 "1225 1 17 42\n"
631 "2419 5 25 79\n"
632 "1317 12 9 49\n"
633 "1131 3 16 71\n"
634 "2045 2 14 99\n"
635 "1581 12 24 33\n"
636 "2403 1 6 51\n"
637 "1853 10 17 16\n"
638 "2653 7 28 2\n"
639 "1813 10 23 4\n"
640 "1137 7 14 89\n"
641 "2279 7 14 99\n"
642 "2911 7 15 26\n"
643 "1895 3 23 95\n"
644 "1651 12 2 44\n"
645 "2321 4 7 67\n"
646 "1796 10 9 65\n"
647 "1287 5 22 90\n"
648 "2579 12 3 48\n"
649 "1883 8 22 87\n"
650 "2701 1 11 99\n"
651 "1227 2 9 63\n"
652 "1476 4 25 57\n"
653 "2682 5 7 83\n"
654 "2192 11 17 98\n"
655 "2337 12 13 76\n"
656 "2594 5 23 45\n"
657 "2473 2 2 77\n"
658 "2779 2 22 22\n"
659 "1576 4 15 62\n"
660 "2514 7 31 26\n"
661 "2086 5 5 6\n"
662 "1497 10 16 39\n"
663 "2081 11 10 61\n"
664 "1413 4 29 49\n"
665 "2602 2 4 49\n"
666 "2467 5 29 15\n"
667 "1639 8 9 42\n"
668 "1370 10 20 12\n"
669 "1006 5 22 31\n"
670 "1984 2 17 15\n"
671 "1365 2 22 79\n"
672 "1120 12 9 27\n"
673 "2641 4 26 25\n"
674 "1868 10 1 36\n"
675 "2542 11 28 89\n"
676 "2038 1 11 87\n"
677 "1976 2 25 72\n"
678 "1757 6 11 55\n"
679 "2754 9 21 49\n"
680 "2500 9 23 34\n"
681 "1218 5 5 83\n"
682 "2909 9 24 66\n"
683 "1570 11 3 61\n"
684 "1652 1 8 88\n"
685 "1837 12 10 98\n"
686 "2999 11 30 4\n"
687 "2941 8 18 56\n"
688 "1109 12 6 94\n"
689 "1249 5 31 72\n"
690 "1125 3 13 72\n"
691 "2936 11 3 24\n"
692 "2240 6 30 97\n"
693 "2134 4 24 72\n"
694 "1979 1 23 50\n"
695 "2638 2 9 67\n"
696 "2695 2 27 20\n"
697 "1738 10 10 92\n"
698 "2749 5 3 70\n"
699 "1794 9 13 19\n"
700 "1607 7 2 74\n"
701 "1118 4 23 99\n"
702 "2516 8 14 48\n"
703 "1680 7 19 79\n"
704 "2351 4 27 77\n"
705 "1644 6 24 23\n"
706 "1508 3 3 45\n"
707 "1361 4 1 78\n"
708 "2961 8 8 90\n"
709 "2316 1 7 29\n"
710 "1193 2 24 62\n"
711 "1132 3 17 12\n"
712 "2232 12 13 37\n"
713 "1911 9 20 40\n"
714 "1785 3 27 56\n"
715 "1038 7 22 67\n"
716 "1361 4 7 52\n"
717 "1410 12 19 89\n"
718 "1092 8 25 84\n"
719 "1852 4 27 20\n"
720 "1768 8 31 31\n"
721 "2451 7 7 48\n"
722 "1090 9 27 1\n"
723 "1349 3 14 98\n"
724 "2694 5 1 97\n"
725 "1242 10 25 66\n"
726 "2826 5 1 83\n"
727 "1172 9 9 71\n"
728 "1079 12 31 62\n"
729 "1731 10 20 20\n"
730 "1548 1 11 42\n"
731 "1180 8 22 43\n"
732 "1162 1 4 85\n"
733 "1037 8 14 28\n"
734 "1610 4 18 59\n"
735 "2001 8 28 35\n"
736 "1898 1 11 46\n"
737 "1085 2 11 90\n"
738 "1409 10 11 65\n"
739 "1920 3 31 58\n"
740 "2341 10 23 28\n"
741 "1180 12 23 33\n"
742 "1701 10 1 16\n"
743 "2621 2 4 33\n"
744 "2141 10 7 6\n"
745 "1057 8 27 55\n"
746 "2489 2 2 93\n"
747 "1993 7 3 55");
748 auto out = ostringstream();
749 main(in, out);
750 const auto ans = out.str();
751 ASSERT_EQ("1940-11-10\n"
752 "2261-06-20\n"
753 "2181-07-14\n"
754 "1321-03-17\n"
755 "1817-10-06\n"
756 "2027-06-13\n"
757 "1891-01-16\n"
758 "2913-03-15\n"
759 "1784-11-07\n"
760 "2921-12-18\n"
761 "2846-10-23\n"
762 "2907-03-11\n"
763 "1762-01-12\n"
764 "1538-03-03\n"
765 "2645-07-16\n"
766 "1974-02-04\n"
767 "2604-03-13\n"
768 "2925-11-11\n"
769 "2188-11-17\n"
770 "1723-02-03\n"
771 "2124-11-22\n"
772 "2950-09-17\n"
773 "2742-09-25\n"
774 "2144-01-28\n"
775 "2666-08-03\n"
776 "1051-01-22\n"
777 "2327-04-28\n"
778 "1846-11-11\n"
779 "2615-04-25\n"
780 "1024-06-22\n"
781 "1048-05-06\n"
782 "1977-10-12\n"
783 "1339-11-30\n"
784 "1315-08-20\n"
785 "1403-08-15\n"
786 "1987-02-06\n"
787 "1225-02-28\n"
788 "2419-08-12\n"
789 "1318-01-27\n"
790 "1131-05-26\n"
791 "2045-05-24\n"
792 "1582-01-26\n"
793 "2403-02-26\n"
794 "1853-11-02\n"
795 "2653-07-30\n"
796 "1813-10-27\n"
797 "1137-10-11\n"
798 "2279-10-21\n"
799 "2911-08-10\n"
800 "1895-06-26\n"
801 "1652-01-15\n"
802 "2321-06-13\n"
803 "1796-12-13\n"
804 "1287-08-20\n"
805 "2580-01-20\n"
806 "1883-11-17\n"
807 "2701-04-20\n"
808 "1227-04-13\n"
809 "1476-06-21\n"
810 "2682-07-29\n"
811 "2193-02-23\n"
812 "2338-02-27\n"
813 "2594-07-07\n"
814 "2473-04-20\n"
815 "2779-03-16\n"
816 "1576-06-16\n"
817 "2514-08-26\n"
818 "2086-05-11\n"
819 "1497-11-24\n"
820 "2082-01-10\n"
821 "1413-06-17\n"
822 "2602-03-25\n"
823 "2467-06-13\n"
824 "1639-09-20\n"
825 "1370-11-01\n"
826 "1006-06-22\n"
827 "1984-03-03\n"
828 "1365-05-12\n"
829 "1121-01-05\n"
830 "2641-05-21\n"
831 "1868-11-06\n"
832 "2543-02-25\n"
833 "2038-04-08\n"
834 "1976-05-07\n"
835 "1757-08-05\n"
836 "2754-11-09\n"
837 "2500-10-27\n"
838 "1218-07-27\n"
839 "2909-11-29\n"
840 "1571-01-03\n"
841 "1652-04-05\n"
842 "1838-03-18\n"
843 "2999-12-04\n"
844 "2941-10-13\n"
845 "1110-03-10\n"
846 "1249-08-11\n"
847 "1125-05-24\n"
848 "2936-11-27\n"
849 "2240-10-05\n"
850 "2134-07-05\n"
851 "1979-03-14\n"
852 "2638-04-17\n"
853 "2695-03-19\n"
854 "1739-01-10\n"
855 "2749-07-12\n"
856 "1794-10-02\n"
857 "1607-09-14\n"
858 "1118-07-31\n"
859 "2516-10-01\n"
860 "1680-10-06\n"
861 "2351-07-13\n"
862 "1644-07-17\n"
863 "1508-04-17\n"
864 "1361-06-18\n"
865 "2961-11-06\n"
866 "2316-02-05\n"
867 "1193-04-27\n"
868 "1132-03-29\n"
869 "2233-01-19\n"
870 "1911-10-30\n"
871 "1785-05-22\n"
872 "1038-09-27\n"
873 "1361-05-29\n"
874 "1411-03-18\n"
875 "1092-11-17\n"
876 "1852-05-17\n"
877 "1768-10-01\n"
878 "2451-08-24\n"
879 "1090-09-28\n"
880 "1349-06-20\n"
881 "2694-08-06\n"
882 "1242-12-30\n"
883 "2826-07-23\n"
884 "1172-11-19\n"
885 "1080-03-02\n"
886 "1731-11-09\n"
887 "1548-02-22\n"
888 "1180-10-04\n"
889 "1162-03-30\n"
890 "1037-09-11\n"
891 "1610-06-16\n"
892 "2001-10-02\n"
893 "1898-02-26\n"
894 "1085-05-12\n"
895 "1409-12-15\n"
896 "1920-05-28\n"
897 "2341-11-20\n"
898 "1181-01-25\n"
899 "1701-10-17\n"
900 "2621-03-09\n"
901 "2141-10-13\n"
902 "1057-10-21\n"
903 "2489-05-06\n"
904 "1993-08-27\n",
905 ans);
906 }
907 }// namespace acwing3573
908
909 namespace acwing3302_408 {
910 TEST(acwing3302_408, case1) {
911 istringstream in("(2+2)*(1+1)");
912 auto out = ostringstream();
913 main(in, out);
914 const auto ans = out.str();
915 ASSERT_EQ("8",
916 ans);
917 }
918
919 TEST(acwing3302_408, case2) {
920 istringstream in("(3+5*4/2+2*(1+1)*(2+2))");
921 auto out = ostringstream();
922 main(in, out);
923 const auto ans = out.str();
924 ASSERT_EQ("29", ans);
925 }
926
927 TEST(acwing3302_408, case3) {
928 istringstream in("2*10-1000+24-(5*3)+(3*2)");
929 auto out = ostringstream();
930 main(in, out);
931 const auto ans = out.str();
932 ASSERT_EQ("-965", ans);
933 }
934 }// namespace acwing3302_408
935
936 namespace acwing148 {
937 TEST(acwing148, case1) {
938 istringstream in("3 \n"
939 "1 2 9 ");
940 auto out = ostringstream();
941 main(in, out);
942 const auto ans = out.str();
943 ASSERT_EQ("15", ans);
944 }
945 }// namespace acwing148
946
947 namespace acwing836_408 {
948 TEST(acwing836_408, case1) {
949 istringstream in("4 5\n"
950 "M 1 2\n"
951 "M 3 4\n"
952 "Q 1 2\n"
953 "Q 1 3\n"
954 "Q 3 4");
955 auto out = ostringstream();
956 main(in, out);
957 const auto ans = out.str();
958 ASSERT_EQ("Yes\n"
959 "No\n"
960 "Yes\n",
961 ans);
962 }
963 }// namespace acwing836_408
964
968 namespace acwing3786 {
969 TEST(acwing3786, case1) {
970 istringstream in("6\n"
971 "1 1\n"
972 "1 3\n"
973 "1 5\n"
974 "3 4\n"
975 "2 3\n"
976 "4 2");
977 auto out = ostringstream();
978 main(in, out);
979 const auto ans = out.str();
980 ASSERT_EQ("3\n"
981 "5\n",
982 ans);
983 }
984
985 TEST(acwing3786, case2) {
986 istringstream in("20\n"
987 "1 -9\n"
988 "1 5\n"
989 "2 5\n"
990 "2 -9\n"
991 "1 -5\n"
992 "1 -4\n"
993 "4 -19\n"
994 "1 -10\n"
995 "2 -4\n"
996 "2 -10\n"
997 "1 -14\n"
998 "4 -17\n"
999 "4 -10\n"
1000 "2 -14\n"
1001 "1 -12\n"
1002 "1 -3\n"
1003 "3 -8\n"
1004 "1 -7\n"
1005 "4 -18\n"
1006 "1 1");
1007 auto out = ostringstream();
1008 main(in, out);
1009 const auto ans = out.str();
1010 ASSERT_EQ("-5\n"
1011 "-14\n"
1012 "-5\n"
1013 "-12\n"
1014 "-12\n",
1015 ans);
1016 }
1017 }// namespace acwing3786
1018
1022 namespace acwing149 {
1023 TEST(acwing149, case1) {
1024 istringstream in("4 2\n"
1025 "1\n"
1026 "1\n"
1027 "2\n"
1028 "2");
1029 auto out = ostringstream();
1030 main(in, out);
1031 const auto ans = out.str();
1032 ASSERT_EQ("12\n"
1033 "2\n",
1034 ans);
1035 }
1036
1037 TEST(acwing149, case2) {
1038 istringstream in("3 2\n"
1039 "1\n"
1040 "2\n"
1041 "3");
1042 auto out = ostringstream();
1043 main(in, out);
1044 const auto ans = out.str();
1045 ASSERT_EQ("9\n"
1046 "2\n",
1047 ans);
1048 }
1049
1050 TEST(acwing149, case3) {
1051 istringstream in("16 3\n"
1052 "98\n"
1053 "98\n"
1054 "98\n"
1055 "98\n"
1056 "98\n"
1057 "98\n"
1058 "98\n"
1059 "98\n"
1060 "98\n"
1061 "98\n"
1062 "98\n"
1063 "98\n"
1064 "98\n"
1065 "98\n"
1066 "98\n"
1067 "98");
1068 auto out = ostringstream();
1069 main(in, out);
1070 const auto ans = out.str();
1071 ASSERT_EQ("4214\n"
1072 "3\n",
1073 ans);
1074 }
1075 }// namespace acwing149
1076
1080 namespace acwing831_408 {
1081 TEST(acwing831_408, case1) {
1082 istringstream in("3\n"
1083 "aba\n"
1084 "5\n"
1085 "ababa");
1086 auto out = ostringstream();
1087 main(in, out);
1088 const auto ans = out.str();
1089 ASSERT_EQ("0 2 ",
1090 ans);
1091 }
1092 }// namespace acwing831_408
1093
1097 namespace acwing3385 {
1098 TEST(acwing3385, case1) {
1099 istringstream in("5\n"
1100 "02120\n");
1101 auto out = ostringstream();
1102 main(in, out);
1103 const auto ans = out.str();
1104 ASSERT_EQ("1",
1105 ans);
1106 }
1107 }// namespace acwing3385
1108
1112 namespace acwing3429 {
1113 TEST(acwing3429, case1) {
1114 istringstream in("abc");
1115 auto out = ostringstream();
1116 main(in, out);
1117 const auto ans = out.str();
1118 ASSERT_EQ("abc\n"
1119 "acb\n"
1120 "bac\n"
1121 "bca\n"
1122 "cab\n"
1123 "cba\n",
1124 ans);
1125 }
1126 }// namespace acwing3429
1127
1131 namespace acwing858_408 {
1132 TEST(acwing858_408, case1) {
1133 istringstream in("4 5\n"
1134 "1 2 1\n"
1135 "1 3 2\n"
1136 "1 4 3\n"
1137 "2 3 2\n"
1138 "3 4 4");
1139 auto out = ostringstream();
1140 main(in, out);
1141 const auto ans = out.str();
1142 ASSERT_EQ("6", ans);
1143 }
1144 }// namespace acwing858_408
1145
1149 namespace acwing849_408 {
1150 TEST(acwing849_408, case1) {
1151 istringstream in("3 3\n"
1152 "1 2 2\n"
1153 "2 3 1\n"
1154 "1 3 4");
1155 auto out = ostringstream();
1156 main(in, out);
1157 const auto ans = out.str();
1158 ASSERT_EQ("3", ans);
1159 }
1160
1161 TEST(acwing849_408, case2) {
1162 istringstream in("5 10\n"
1163 "1 2 2\n"
1164 "5 3 3\n"
1165 "4 1 8\n"
1166 "2 4 3\n"
1167 "4 5 7\n"
1168 "5 2 3\n"
1169 "3 4 1\n"
1170 "1 2 9\n"
1171 "3 2 3\n"
1172 "1 2 8");
1173 auto out = ostringstream();
1174 main(in, out);
1175 const auto ans = out.str();
1176 ASSERT_EQ("12", ans);
1177 }
1178 }// namespace acwing849_408
1179
1183 namespace acwing854_408 {
1184 TEST(acwing854_408, case1) {
1185 istringstream in("3 3 2\n"
1186 "1 2 1\n"
1187 "2 3 2\n"
1188 "1 3 1\n"
1189 "2 1\n"
1190 "1 3");
1191 auto out = ostringstream();
1192 main(in, out);
1193 const auto ans = out.str();
1194 ASSERT_EQ("impossible\n"
1195 "1\n",
1196 ans);
1197 }
1198 }// namespace acwing854_408
1199
1203 namespace acwing848_408 {
1204 TEST(acwing848_408, case1) {
1205 istringstream in("3 3\n"
1206 "1 2\n"
1207 "2 3\n"
1208 "1 3");
1209 auto out = ostringstream();
1210 main(in, out);
1211 const auto ans = out.str();
1212 ASSERT_EQ("1 2 3 ",
1213 ans);
1214 }
1215
1216 TEST(acwing848_408, case2) {
1217 istringstream in("5 10\n"
1218 "2 3\n"
1219 "2 5\n"
1220 "2 5\n"
1221 "1 4\n"
1222 "2 4\n"
1223 "1 2\n"
1224 "2 3\n"
1225 "2 4\n"
1226 "3 5\n"
1227 "3 4");
1228 auto out = ostringstream();
1229 main(in, out);
1230 const auto ans = out.str();
1231 ASSERT_EQ("1 2 3 4 5 ",
1232 ans);
1233 }
1234
1235 TEST(acwing848_408, case3) {
1236 istringstream in("10 20\n"
1237 "2 3\n"
1238 "5 10\n"
1239 "1 5\n"
1240 "2 5\n"
1241 "4 6\n"
1242 "1 2\n"
1243 "4 5\n"
1244 "3 7\n"
1245 "2 10\n"
1246 "4 4\n"
1247 "1 7\n"
1248 "1 2\n"
1249 "1 4\n"
1250 "3 8\n"
1251 "7 8\n"
1252 "1 2\n"
1253 "2 5\n"
1254 "4 7\n"
1255 "2 9\n"
1256 "3 10");
1257 auto out = ostringstream();
1258 main(in, out);
1259 const auto ans = out.str();
1260 ASSERT_EQ("-1",
1261 ans);
1262 }
1263
1264 TEST(acwing848_408, case4) {
1265 istringstream in("4 4\n"
1266 "2 1\n"
1267 "1 3\n"
1268 "1 4\n"
1269 "3 4");
1270 auto out = ostringstream();
1271 main(in, out);
1272 const auto ans = out.str();
1273 ASSERT_EQ("2 1 3 4 ",
1274 ans);
1275 }
1276 }// namespace acwing848_408
1277
1281 namespace acwing3402 {
1282 TEST(acwing3402, case1) {
1283 istringstream in("3 4\n"
1284 "1 2 0 0\n"
1285 "0 0 0 0\n"
1286 "3 0 0 0");
1287 auto out = ostringstream();
1288 main(in, out);
1289 const auto ans = out.str();
1290 ASSERT_EQ("1 3 3\n"
1291 "1 4 4\n"
1292 "2 1 2\n",
1293 ans);
1294 }
1295 }// namespace acwing3402
1296
1300 namespace acwing3472 {
1301 TEST(acwing3472, case1) {
1302 istringstream in("2\n"
1303 "1\n"
1304 "92");
1305 auto out = ostringstream();
1306 main(in, out);
1307 const auto ans = out.str();
1308 ASSERT_EQ("15863724\n"
1309 "84136275\n",
1310 ans);
1311 }
1312 }// namespace acwing3472
1313
1317 namespace acwing3439 {
1318 TEST(acwing3439, case1) {
1319 istringstream in("if so, you already have a google account. you can sign in on the right.");
1320 auto out = ostringstream();
1321 main(in, out);
1322 const auto ans = out.str();
1323 ASSERT_EQ("If So, You Already Have A Google Account. You Can Sign In On The Right.",
1324 ans);
1325 }
1326
1327 TEST(acwing3439, case2) {
1328 istringstream in("Lke IioARt mXN bAqKm yzIU oiG wcczrp W Qr j auy iL lMtAfH CEVaj ni JPoWl DcUMiqmNMGJ p hs a");
1329 auto out = ostringstream();
1330 main(in, out);
1331 const auto ans = out.str();
1332 ASSERT_EQ("Lke IioARt MXN BAqKm YzIU OiG Wcczrp W Qr J Auy IL LMtAfH CEVaj Ni JPoWl DcUMiqmNMGJ P Hs A",
1333 ans);
1334 }
1335 }// namespace acwing3439
1336
1340 namespace acwing3379 {
1341 TEST(acwing3379, case1) {
1342 istringstream in("Upin\n"
1343 "cvYj\n"
1344 "WJpw\n"
1345 "cXOA");
1346 auto out = ostringstream();
1347 main(in, out);
1348 const auto ans = out.str();
1349 ASSERT_EQ("nipU\n"
1350 "jYvc\n"
1351 "wpJW\n"
1352 "AOXc\n",
1353 ans);
1354 }
1355 }// namespace acwing3379
1356
1360 namespace acwing3390 {
1361 TEST(acwing3390, case1) {
1362 istringstream in("123 45");
1363 auto out = ostringstream();
1364 main(in, out);
1365 const auto ans = out.str();
1366 ASSERT_EQ("54", ans);
1367 }
1368 }// namespace acwing3390
1369
1373 namespace acwing3397 {
1374 TEST(acwing3397, case1) {
1375 istringstream in("3 2\n"
1376 "31 32 30");
1377 auto out = ostringstream();
1378 main(in, out);
1379 const auto ans = out.str();
1380 ASSERT_EQ("0\n"
1381 "3\n",
1382 ans);
1383 }
1384 }// namespace acwing3397
1385
1389 namespace acwing3426 {
1390 TEST(acwing3426, case1) {
1391 istringstream in("6\n"
1392 "36\n"
1393 "2\n"
1394 "2\n"
1395 "2\n"
1396 "2\n"
1397 "2\n"
1398 "11\n"
1399 "22\n"
1400 "20\n"
1401 "18\n"
1402 "16\n"
1403 "14\n"
1404 "12\n"
1405 "10\n"
1406 "8\n"
1407 "6\n"
1408 "4\n"
1409 "2\n"
1410 "4\n"
1411 "2\n"
1412 "4\n"
1413 "6\n"
1414 "8\n"
1415 "0");
1416 auto out = ostringstream();
1417 main(in, out);
1418 const auto ans = out.str();
1419 ASSERT_EQ("15 14\n"
1420 "17 22\n"
1421 "4 8\n",
1422 ans);
1423 }
1424 }// namespace acwing3426
1425
1429 namespace acwing3406 {
1430 TEST(acwing3406, case1) {
1431 istringstream in("hs_10000_p 2007-01-17 19:22:53,315 253.035(s)\n"
1432 "hs_10001_p 2007-01-17 19:22:53,315 253.846(s)\n"
1433 "hs_10002_m 2007-01-17 19:22:53,315 129.574(s)\n"
1434 "hs_10002_p 2007-01-17 19:22:53,315 262.531(s)\n"
1435 "hs_10003_m 2007-01-17 19:22:53,318 126.622(s)\n"
1436 "hs_10003_p 2007-01-17 19:22:53,318 136.962(s)\n"
1437 "hs_10005_m 2007-01-17 19:22:53,318 130.487(s)\n"
1438 "hs_10005_p 2007-01-17 19:22:53,318 253.035(s)\n"
1439 "hs_10006_m 2007-01-17 19:22:53,318 248.548(s)\n"
1440 "hs_10006_p 2007-01-17 19:25:23,367 3146.827(s)");
1441 auto out = ostringstream();
1442 main(in, out);
1443 const auto ans = out.str();
1444 ASSERT_EQ("hs_10003_m 2007-01-17 19:22:53,318 126.622(s)\n"
1445 "hs_10002_m 2007-01-17 19:22:53,315 129.574(s)\n"
1446 "hs_10005_m 2007-01-17 19:22:53,318 130.487(s)\n"
1447 "hs_10003_p 2007-01-17 19:22:53,318 136.962(s)\n"
1448 "hs_10006_m 2007-01-17 19:22:53,318 248.548(s)\n"
1449 "hs_10000_p 2007-01-17 19:22:53,315 253.035(s)\n"
1450 "hs_10005_p 2007-01-17 19:22:53,318 253.035(s)\n"
1451 "hs_10001_p 2007-01-17 19:22:53,315 253.846(s)\n"
1452 "hs_10002_p 2007-01-17 19:22:53,315 262.531(s)\n"
1453 "hs_10006_p 2007-01-17 19:25:23,367 3146.827(s)\n",
1454 ans);
1455 }
1456
1457 TEST(acwing3406, case2) {
1458 istringstream in("hs_10000_p 2007-01-17 19:22:53,315 253.035(s)\n"
1459 "hs_10001_p 2007-01-17 19:22:53,315 253.846(s)\n"
1460 "hs_10002_m 2007-01-17 19:22:53,315 129.574(s)\n"
1461 "hs_10002_p 2007-01-17 19:22:53,315 262.531(s)\n"
1462 "hs_10003_m 2007-01-17 19:22:53,318 126.622(s)\n"
1463 "hs_10003_p 2007-01-17 19:22:53,318 136.962(s)\n"
1464 "hs_10005_m 2007-01-17 19:22:53,318 130.487(s)\n"
1465 "hs_10005_p 2007-01-17 19:22:53,318 253.035(s)\n"
1466 "hs_10006_m 2007-01-17 19:22:53,318 248.548(s)\n"
1467 "hs_10006_p 2007-01-17 19:25:23,367 3146.827(s)\n"
1468 "hs_10000_x 2007-01-17 19:22:52,315 253.035(s)\n"
1469 "hs_10000_y 2007-01-17 19:20:53,315 253.035(s)\n"
1470 "hs_10000_z 2007-01-17 18:22:53,315 253.035(s)\n"
1471 "hs_10000_q 2007-01-16 19:22:53,315 253.035(s)\n"
1472 "hs_10000_r 2007-02-17 19:22:53,315 253.035(s)\n"
1473 "hs_10000_s 2008-01-17 19:22:53,315 253.035(s)");
1474 auto out = ostringstream();
1475 main(in, out);
1476 const auto ans = out.str();
1477 ASSERT_EQ("hs_10003_m 2007-01-17 19:22:53,318 126.622(s)\n"
1478 "hs_10002_m 2007-01-17 19:22:53,315 129.574(s)\n"
1479 "hs_10005_m 2007-01-17 19:22:53,318 130.487(s)\n"
1480 "hs_10003_p 2007-01-17 19:22:53,318 136.962(s)\n"
1481 "hs_10006_m 2007-01-17 19:22:53,318 248.548(s)\n"
1482 "hs_10000_q 2007-01-16 19:22:53,315 253.035(s)\n"
1483 "hs_10000_z 2007-01-17 18:22:53,315 253.035(s)\n"
1484 "hs_10000_y 2007-01-17 19:20:53,315 253.035(s)\n"
1485 "hs_10000_x 2007-01-17 19:22:52,315 253.035(s)\n"
1486 "hs_10000_p 2007-01-17 19:22:53,315 253.035(s)\n"
1487 "hs_10005_p 2007-01-17 19:22:53,318 253.035(s)\n"
1488 "hs_10000_r 2007-02-17 19:22:53,315 253.035(s)\n"
1489 "hs_10000_s 2008-01-17 19:22:53,315 253.035(s)\n"
1490 "hs_10001_p 2007-01-17 19:22:53,315 253.846(s)\n"
1491 "hs_10002_p 2007-01-17 19:22:53,315 262.531(s)\n"
1492 "hs_10006_p 2007-01-17 19:25:23,367 3146.827(s)\n",
1493 ans);
1494 }
1495 }// namespace acwing3406
1496
1500 namespace acwing3447 {
1501 TEST(acwing3447, case1) {
1502 istringstream in("10101");
1503 auto out = ostringstream();
1504 main(in, out);
1505 const auto ans = out.str();
1506 ASSERT_EQ("0 2\n"
1507 "01 2\n"
1508 "1 3\n"
1509 "10 2\n"
1510 "101 2\n",
1511 ans);
1512 }
1513 }// namespace acwing3447
1514
1518 namespace acwing3820 {
1519 TEST(acwing3820, case1) {
1520 vector<int> in = {-5, 3, 2, 3};
1521 findMissMin(in);
1522 ASSERT_EQ(findMissMin(in), 1);
1523 }
1524
1525 TEST(acwing3820, case2) {
1526 vector<int> in = {1, 2, 3};
1527 findMissMin(in);
1528 ASSERT_EQ(findMissMin(in), 4);
1529 }
1530 }// namespace acwing3820
1531
1535 namespace acwing840_408 {
1536 TEST(acwing840_408, case2) {
1537 istringstream in("5\n"
1538 "I 1\n"
1539 "I 2\n"
1540 "I 3\n"
1541 "Q 2\n"
1542 "Q 5");
1543 auto out = ostringstream();
1544 main(in, out);
1545 const auto ans = out.str();
1546 ASSERT_EQ("Yes\n"
1547 "No\n",
1548 ans);
1549 }
1550 }// namespace acwing840_408
1551
1555 namespace acwing3542 {
1556 TEST(acwing3542, case1) {
1557 istringstream in("5\n"
1558 "1 5 2 4 3\n"
1559 "3\n"
1560 "2 5 6");
1561 auto out = ostringstream();
1562 main(in, out);
1563 const auto ans = out.str();
1564 ASSERT_EQ("YES\n"
1565 "YES\n"
1566 "NO\n",
1567 ans);
1568 }
1569 }// namespace acwing3542
1570
1574 namespace acwing3581 {
1575 TEST(acwing3542, case1) {
1576 istringstream in("A blockhouse is a small castle that has four openings through which to shoot.");
1577 auto out = ostringstream();
1578 main(in, out);
1579 const auto ans = out.str();
1580 ASSERT_EQ("a:2\n"
1581 "blockhouse:1\n"
1582 "castle:1\n"
1583 "four:1\n"
1584 "has:1\n"
1585 "is:1\n"
1586 "openings:1\n"
1587 "shoot:1\n"
1588 "small:1\n"
1589 "that:1\n"
1590 "through:1\n"
1591 "to:1\n"
1592 "which:1\n",
1593 ans);
1594 }
1595
1596 TEST(acwing3542, case2) {
1597 istringstream in("ZhnqZlbTCiol .,YHsWlKfYf.,.Ug, .LPkReTwCoTUVAY.,Pv .BZRkvRZ,..uoeeEtwPLn.oLjdlYaolkctEM EUbsyHRPfHgtKXw s .a.HVZk. .JV ..TP,msuKHuIHETiPdNe, A,,.L,,.mbppWtkj.. KoURloeEO. URJNwpFSj,FCfPqxH .Hvzk KzoZGPIRh .cluMByzNQCnrds. lPKrEtWCOTUvAY...a,,UQq,.TP.IDNmLWyuBA ,ukTFWJtGaYpv,.kOurLOeEO,,.pwBwtcIPBNjQaX, Gzc .FY.ug,,sZzrQnZnoKAyvOT,.ynHN, .iht,hVZK. SzzrqNznoKAYvoT.. a. GzC. ,uoEEETWpLn,,jmozwuAaMnTCBx . URjNwPfsJ,BDQxCSWMkebF,, lPkretWcotUVaY . UOeeetWpln pWBwtcIpBnjqAx CluMbYZNqcnrDS,,,MBPPwTkj pujlNV,..BzrkvrZ,.NJ,,,OTjJ zbWP..FaIPSfd ,VbAXOCeUuc ..PAoOyvSlYxjcwA uQQ cmmhLELseIBMmj ZBWP,.ZPVxAgLRHmPmn lPKrETwCOtuvAY jV rrfG,URJNWpfSJ. xDKcrUHgv EhKqG .MsUKhuIHeTipdnE ,,kZOzgPIRH vgWC.,EhKqg zhNqzLbTCioL.,uktfWJTGaYPV. ,fcfPQXh..Q.BDQXcSWMkeBF..fY,nJ,,PBODNCHgtV,, TOrAepgX koURlOeEo.,.PwBWTcIPbnJQax,,OSfU Jv,,ENTiYAJD.zPvXagLrHmpmN.oTJJ.,.EbnaotBLnRhwdX. ,UkTfWjtgaypv ..EbNAOtBLNRhwdx pAOOYVsLYXjCWA SZZRQnZNOkayVot.,.EbnaOtblNrHwdx ,KzoZgpirH, LPkretwcotuvAY..cRyi,.Rrfg.cmM");
1598 auto out = ostringstream();
1599 main(in, out);
1600 const auto ans = out.str();
1601 ASSERT_EQ("a:4\n"
1602 "bdqxcswmkebf:2\n"
1603 "bzrkvrz:2\n"
1604 "clumbyznqcnrds:2\n"
1605 "cmm:1\n"
1606 "cmmhlelseibmmj:1\n"
1607 "cryi:1\n"
1608 "ebnaotblnrhwdx:3\n"
1609 "ehkqg:2\n"
1610 "entiyajd:1\n"
1611 "eubsyhrpfhgtkxw:1\n"
1612 "faipsfd:1\n"
1613 "fcfpqxh:2\n"
1614 "fy:2\n"
1615 "gzc:2\n"
1616 "hvzk:3\n"
1617 "idnmlwyuba:1\n"
1618 "iht:1\n"
1619 "jmozwuaamntcbx:1\n"
1620 "jv:3\n"
1621 "kourloeeo:3\n"
1622 "kzozgpirh:3\n"
1623 "l:1\n"
1624 "lpkretwcotuvay:5\n"
1625 "mbppwtkj:2\n"
1626 "msukhuihetipdne:2\n"
1627 "nj:2\n"
1628 "oljdlyaolkctem:1\n"
1629 "osfu:1\n"
1630 "otjj:2\n"
1631 "paooyvslyxjcwa:2\n"
1632 "pbodnchgtv:1\n"
1633 "pujlnv:1\n"
1634 "pv:1\n"
1635 "pwbwtcipbnjqax:3\n"
1636 "q:1\n"
1637 "rrfg:2\n"
1638 "s:1\n"
1639 "szzrqnznokayvot:3\n"
1640 "toraepgx:1\n"
1641 "tp:2\n"
1642 "ug:2\n"
1643 "uktfwjtgaypv:3\n"
1644 "uoeeetwpln:3\n"
1645 "uqq:2\n"
1646 "urjnwpfsj:3\n"
1647 "vbaxoceuuc:1\n"
1648 "vgwc:1\n"
1649 "xdkcruhgv:1\n"
1650 "yhswlkfyf:1\n"
1651 "ynhn:1\n"
1652 "zbwp:2\n"
1653 "zhnqzlbtciol:2\n"
1654 "zpvxaglrhmpmn:2\n",
1655 ans);
1656 }
1657 }// namespace acwing3581
1658
1662 namespace acwing785_408 {
1663 TEST(acwing785_408, case1) {
1664 istringstream in("5\n"
1665 "3 1 2 4 5");
1666 auto out = ostringstream();
1667 main(in, out);
1668 const auto ans = out.str();
1669 ASSERT_EQ("1 2 3 4 5 ",
1670 ans);
1671 }
1672
1673 TEST(acwing785_408, case2) {
1674 istringstream in("30\n"
1675 "128 294 133 295 175 8 232 248 241 164 11 60 238 133 291 116 6 67 98 67 196 260 181 160 83 160 90 153 233 216");
1676 auto out = ostringstream();
1677 main(in, out);
1678 const auto ans = out.str();
1679 ASSERT_EQ("6 8 11 60 67 67 83 90 98 116 128 133 133 153 160 160 164 175 181 196 216 232 233 238 241 248 260 291 294 295 ",
1680 ans);
1681 }
1682 }// namespace acwing785_408
1683
1687 namespace acwing3504 {
1688 TEST(acwing3504, case1) {
1689 istringstream in("2016");
1690 auto out = ostringstream();
1691 main(in, out);
1692 const auto ans = out.str();
1693 ASSERT_EQ("2016",
1694 ans);
1695 }
1696
1697 TEST(acwing3504, case2) {
1698 istringstream in("o627CSo1");
1699 auto out = ostringstream();
1700 main(in, out);
1701 const auto ans = out.str();
1702 ASSERT_EQ("627",
1703 ans);
1704 }
1705
1706 TEST(acwing3504, case3) {
1707 istringstream in("123456789123abc");
1708 auto out = ostringstream();
1709 main(in, out);
1710 const auto ans = out.str();
1711 ASSERT_EQ("-1",
1712 ans);
1713 }
1714
1715 TEST(acwing3504, case4) {
1716 istringstream in("abc");
1717 auto out = ostringstream();
1718 main(in, out);
1719 const auto ans = out.str();
1720 ASSERT_EQ("-1",
1721 ans);
1722 }
1723 }// namespace acwing3504
1724
1728 namespace acwing1603 {
1729 TEST(acwing1603, case1) {
1730 istringstream in("10\n"
1731 "23 8 10 99 46 2333 46 1 666 555");
1732 auto out = ostringstream();
1733 main(in, out);
1734 const auto ans = out.str();
1735 ASSERT_EQ("0 3611",
1736 ans);
1737 }
1738
1739 TEST(acwing1603, case2) {
1740 istringstream in("13\n"
1741 "110 79 218 69 3721 100 29 135 2 6 13 5188 85");
1742 auto out = ostringstream();
1743 main(in, out);
1744 const auto ans = out.str();
1745 ASSERT_EQ("1 9359",
1746 ans);
1747 }
1748 }// namespace acwing1603
1749
1753 namespace acwing3527 {
1754 TEST(acwing3527, case1) {
1755 istringstream in("3\n"
1756 "1 2 3\n"
1757 "4 5 6\n"
1758 "7 8 9\n"
1759 "7 4 1\n"
1760 "8 5 2\n"
1761 "9 6 3");
1762 auto out = ostringstream();
1763 main(in, out);
1764 const auto ans = out.str();
1765 ASSERT_EQ("90",
1766 ans);
1767 }
1768
1769 TEST(acwing3527, case2) {
1770 istringstream in("6\n"
1771 "5 2 5 1 2 6\n"
1772 "6 4 5 2 3 4\n"
1773 "2 4 3 4 1 1\n"
1774 "5 4 1 4 6 6\n"
1775 "5 4 3 4 1 5\n"
1776 "5 5 1 1 2 5\n"
1777 "6 4 1 6 5 5\n"
1778 "2 3 1 6 1 2\n"
1779 "1 2 4 4 4 1\n"
1780 "5 5 3 1 3 1\n"
1781 "2 4 4 4 5 4\n"
1782 "5 6 2 5 5 5");
1783 auto out = ostringstream();
1784 main(in, out);
1785 const auto ans = out.str();
1786 ASSERT_EQ("-1",
1787 ans);
1788 }
1789 }// namespace acwing3527
1790
1794 namespace acwing3534 {
1795 TEST(acwing3534, case1) {
1796 istringstream in("2 2\n"
1797 "9 8\n"
1798 "9 3");
1799 auto out = ostringstream();
1800 main(in, out);
1801 const auto ans = out.str();
1802 ASSERT_EQ("153 96 \n"
1803 "108 81 \n",
1804 ans);
1805 }
1806 }// namespace acwing3534
1807
1811 namespace acwing3535 {
1812 TEST(acwing3535, case1) {
1813 istringstream in("1 2 3 4 5\n"
1814 "6 7 8 9 10\n"
1815 "11 12 13 14 15\n"
1816 "16 17 18 19 20\n"
1817 "21 22 23 24 25\n"
1818 "1 3 1 1");
1819 auto out = ostringstream();
1820 main(in, out);
1821 const auto ans = out.str();
1822 ASSERT_EQ("11 6 1 4 5 \n"
1823 "12 7 2 9 10 \n"
1824 "13 8 3 14 15 \n"
1825 "16 17 18 19 20 \n"
1826 "21 22 23 24 25 \n",
1827 ans);
1828 }
1829
1830 TEST(acwing3535, case2) {
1831 istringstream in("19 5 7 16 12\n"
1832 "17 9 6 9 11\n"
1833 "9 19 14 10 8\n"
1834 "11 12 20 2 13\n"
1835 "16 10 7 2 10\n"
1836 "1 2 3 4");
1837 auto out = ostringstream();
1838 main(in, out);
1839 const auto ans = out.str();
1840 ASSERT_EQ("19 5 7 16 12 \n"
1841 "17 9 6 9 11 \n"
1842 "9 19 14 2 10 \n"
1843 "11 12 20 13 8 \n"
1844 "16 10 7 2 10 \n",
1845 ans);
1846 }
1847 }// namespace acwing3535
1848
1852 namespace acwing3874 {
1853 TEST(acwing3874, case2) {
1854 istringstream in("3 4 5\n"
1855 "-1 0 9\n"
1856 "-25 -10 10 11\n"
1857 "2 9 17 30 41");
1858 auto out = ostringstream();
1859 main(in, out);
1860 const auto ans = out.str();
1861 ASSERT_EQ("2",
1862 ans);
1863 }
1864 }// namespace acwing3874
1865
1869 namespace acwing52 {
1870 TEST(acwing52, case1) {
1871 vector<int> input = {1, 2, 1, 1, 3};
1873 ASSERT_EQ(moreThanHalfNum_Solution(input), 1);
1874 }
1875 }// namespace acwing52
1876
1880 namespace acwing3392 {
1881 TEST(acwing3392, case1) {
1882 istringstream in("20 1 1 14 5");
1883 auto out = ostringstream();
1884 main(in, out);
1885 const auto ans = out.str();
1886 ASSERT_EQ("8359", ans);
1887 }
1888
1889 TEST(acwing3392, case2) {
1890 istringstream in("1 10000 1 1 1");
1891 auto out = ostringstream();
1892 main(in, out);
1893 const auto ans = out.str();
1894 ASSERT_EQ("0", ans);
1895 }
1896 }// namespace acwing3392
1897
1901 namespace acwing3433 {
1902 TEST(acwing3392, case2) {
1903 istringstream in("4");
1904 auto out = ostringstream();
1905 main(in, out);
1906 const auto ans = out.str();
1907 ASSERT_EQ("5", ans);
1908 }
1909 }// namespace acwing3433
1910
1914 namespace acwing3441 {
1915 TEST(acwing3441, case1) {
1916 istringstream in("3\n"
1917 "# #\n"
1918 " # \n"
1919 "# #\n"
1920 "1\n"
1921 "3\n"
1922 "# #\n"
1923 " # \n"
1924 "# #\n"
1925 "3\n"
1926 "4\n"
1927 " OO \n"
1928 "O O\n"
1929 "O O\n"
1930 " OO \n"
1931 "2\n"
1932 "0");
1933 auto out = ostringstream();
1934 main(in, out);
1935 const auto ans = out.str();
1936 ASSERT_EQ("# #\n"
1937 " # \n"
1938 "# #\n"
1939 "# # # # # # # #\n"
1940 " # # # # \n"
1941 "# # # # # # # #\n"
1942 " # # # # \n"
1943 " # # \n"
1944 " # # # # \n"
1945 "# # # # # # # #\n"
1946 " # # # # \n"
1947 "# # # # # # # #\n"
1948 " # # # # \n"
1949 " # # \n"
1950 " # # # # \n"
1951 " # # \n"
1952 " # \n"
1953 " # # \n"
1954 " # # # # \n"
1955 " # # \n"
1956 " # # # # \n"
1957 "# # # # # # # #\n"
1958 " # # # # \n"
1959 "# # # # # # # #\n"
1960 " # # # # \n"
1961 " # # \n"
1962 " # # # # \n"
1963 "# # # # # # # #\n"
1964 " # # # # \n"
1965 "# # # # # # # #\n"
1966 " OO OO \n"
1967 " O OO O \n"
1968 " O OO O \n"
1969 " OO OO \n"
1970 " OO OO \n"
1971 "O O O O\n"
1972 "O O O O\n"
1973 " OO OO \n"
1974 " OO OO \n"
1975 "O O O O\n"
1976 "O O O O\n"
1977 " OO OO \n"
1978 " OO OO \n"
1979 " O OO O \n"
1980 " O OO O \n"
1981 " OO OO \n",
1982 ans);
1983 }
1984 }// namespace acwing3441
1985
1989 namespace acwing2 {
1990 TEST(acwing2, case1) {
1991 istringstream in("4 5\n"
1992 "1 2\n"
1993 "2 4\n"
1994 "3 4\n"
1995 "4 5");
1996 auto out = ostringstream();
1997 main(in, out);
1998 const auto ans = out.str();
1999 ASSERT_EQ("8", ans);
2000 }
2001 }// namespace acwing2
2002
2006 namespace acwing3445 {
2007 TEST(acwing3445, case1) {
2008 istringstream in("90 4\n"
2009 "20 25\n"
2010 "30 20\n"
2011 "40 50\n"
2012 "10 18");
2013 auto out = ostringstream();
2014 main(in, out);
2015 const auto ans = out.str();
2016 ASSERT_EQ("95", ans);
2017 }
2018
2019 TEST(acwing3445, case2) {
2020 istringstream in("300 20\n"
2021 "19 24\n"
2022 "26 3\n"
2023 "2 5\n"
2024 "17 8\n"
2025 "13 17\n"
2026 "10 9\n"
2027 "19 9\n"
2028 "30 4\n"
2029 "23 24\n"
2030 "9 9\n"
2031 "5 22\n"
2032 "10 15\n"
2033 "9 10\n"
2034 "15 29\n"
2035 "20 14\n"
2036 "8 12\n"
2037 "4 23\n"
2038 "24 22\n"
2039 "16 13\n"
2040 "5 26");
2041 auto out = ostringstream();
2042 main(in, out);
2043 const auto ans = out.str();
2044 ASSERT_EQ("298", ans);
2045 }
2046 }// namespace acwing3445
2047
2051 namespace acwing3442 {
2052 TEST(acwing3442, case1) {
2053 istringstream in("3\n"
2054 "20\n"
2055 "20\n"
2056 "20");
2057 auto out = ostringstream();
2058 main(in, out);
2059 const auto ans = out.str();
2060 ASSERT_EQ("3", ans);
2061 }
2062
2063 TEST(acwing3442, case2) {
2064 istringstream in("20\n"
2065 "1\n"
2066 "2\n"
2067 "2\n"
2068 "5\n"
2069 "4\n"
2070 "5\n"
2071 "5\n"
2072 "2\n"
2073 "3\n"
2074 "5\n"
2075 "1\n"
2076 "4\n"
2077 "3\n"
2078 "5\n"
2079 "4\n"
2080 "3\n"
2081 "3\n"
2082 "2\n"
2083 "3\n"
2084 "5");
2085 auto out = ostringstream();
2086 main(in, out);
2087 const auto ans = out.str();
2088 ASSERT_EQ("37564", ans);
2089 }
2090 }// namespace acwing3442
2091
2095 namespace acwing3382 {
2096 TEST(acwing3382, case1) {
2097 istringstream in("7");
2098 auto out = ostringstream();
2099 main(in, out);
2100 const auto ans = out.str();
2101 ASSERT_EQ("6", ans);
2102 }
2103 }// namespace acwing3382
2104
2108 namespace acwing3389 {
2109 TEST(acwing3389, case1) {
2110 istringstream in("4\n"
2111 "5\n"
2112 "15");
2113 auto out = ostringstream();
2114 main(in, out);
2115 const auto ans = out.str();
2116 ASSERT_EQ("24\n"
2117 "120\n"
2118 "1307674368000\n",
2119 ans);
2120 }
2121 }// namespace acwing3389
2122
2126 namespace acwing3448 {
2127 TEST(acwing3448, case1) {
2128 istringstream in("123 456\n"
2129 "555 555\n"
2130 "123 594\n"
2131 "0 0");
2132 auto out = ostringstream();
2133 main(in, out);
2134 const auto ans = out.str();
2135 ASSERT_EQ("No carry operation.\n"
2136 "3 carry operations.\n"
2137 "1 carry operation.\n",
2138 ans);
2139 }
2140
2141 TEST(acwing3448, case2) {
2142 istringstream in("123 456\n"
2143 "555 555\n"
2144 "123 594\n"
2145 "99999 1\n"
2146 "167 33\n"
2147 "5 55\n"
2148 "0 1\n"
2149 "1654 69565\n"
2150 "999999999 999999999\n"
2151 "0 0");
2152 auto out = ostringstream();
2153 main(in, out);
2154 const auto ans = out.str();
2155 ASSERT_EQ("No carry operation.\n"
2156 "3 carry operations.\n"
2157 "1 carry operation.\n"
2158 "5 carry operations.\n"
2159 "2 carry operations.\n"
2160 "1 carry operation.\n"
2161 "No carry operation.\n"
2162 "3 carry operations.\n"
2163 "9 carry operations.\n",
2164 ans);
2165 }
2166 }// namespace acwing3448
2167
2171 namespace acwing3453 {
2172 TEST(acwing3448, case1) {
2173 istringstream in("123456789012345678901234567890\n"
2174 "123456789012345678901234567890\n"
2175 "123456789012345678901234567890\n"
2176 "0");
2177 auto out = ostringstream();
2178 main(in, out);
2179 const auto ans = out.str();
2180 ASSERT_EQ("370370367037037036703703703670", ans);
2181 }
2182 }// namespace acwing3453
2183
2187 namespace acwing3380 {
2188 TEST(acwing3380, case1) {
2189 istringstream in("120");
2190 auto out = ostringstream();
2191 main(in, out);
2192 const auto ans = out.str();
2193 ASSERT_EQ("5\n", ans);
2194 }
2195
2196 TEST(acwing3380, case2) {
2197 istringstream in("153297569\n"
2198 "594432637\n"
2199 "659602991\n"
2200 "458462013\n"
2201 "337494475\n"
2202 "238464665\n"
2203 "13359727\n"
2204 "795497352\n"
2205 "86320458\n"
2206 "684897561\n"
2207 "851367896\n"
2208 "999999599\n"
2209 "999999223\n"
2210 "238773878\n"
2211 "186862050\n"
2212 "289691012\n"
2213 "322255235\n"
2214 "999998023\n"
2215 "449518270\n"
2216 "145866395\n"
2217 "674175420\n"
2218 "965180886\n"
2219 "894529843\n"
2220 "757148635\n"
2221 "567743053\n"
2222 "188315963\n"
2223 "963993450\n"
2224 "523693501\n"
2225 "484634037\n"
2226 "797090095\n"
2227 "525850373\n"
2228 "999998863\n"
2229 "366476127\n"
2230 "926629123\n"
2231 "441584822\n"
2232 "652965457\n"
2233 "332893800\n"
2234 "65465111\n"
2235 "999999893\n"
2236 "224232641\n"
2237 "608808463\n"
2238 "989660733\n"
2239 "999998537\n"
2240 "198426748\n"
2241 "727985684\n"
2242 "374390678\n"
2243 "999998609\n"
2244 "999998641\n"
2245 "198318145\n"
2246 "999998533\n"
2247 "833700685\n"
2248 "762460148\n"
2249 "236737316\n"
2250 "999997967\n"
2251 "999998059\n"
2252 "314157275\n"
2253 "94235972\n"
2254 "357160876\n"
2255 "978584525\n"
2256 "999998683\n"
2257 "413637171\n"
2258 "465296810\n"
2259 "999999883\n"
2260 "23518975\n"
2261 "151126261\n"
2262 "68452145\n"
2263 "999998003\n"
2264 "86700479\n"
2265 "92785530\n"
2266 "721403011\n"
2267 "789286270\n"
2268 "47265221\n"
2269 "775066945\n"
2270 "896679144\n"
2271 "265114090\n"
2272 "255838329\n"
2273 "999999059\n"
2274 "999998959\n"
2275 "999998929\n"
2276 "987198276\n"
2277 "954102776\n"
2278 "357980512\n"
2279 "999999107\n"
2280 "999999541\n"
2281 "285426256\n"
2282 "70024864\n"
2283 "510689713\n"
2284 "999999757\n"
2285 "84010461\n"
2286 "977451172\n"
2287 "2410627\n"
2288 "549027526\n"
2289 "999999131\n"
2290 "75025319\n"
2291 "999998017\n"
2292 "705069535\n"
2293 "983668771\n"
2294 "963859038\n"
2295 "999999323\n"
2296 "999998687");
2297 auto out = ostringstream();
2298 main(in, out);
2299 const auto ans = out.str();
2300 ASSERT_EQ("2\n"
2301 "3\n"
2302 "2\n"
2303 "3\n"
2304 "5\n"
2305 "2\n"
2306 "3\n"
2307 "8\n"
2308 "9\n"
2309 "4\n"
2310 "4\n"
2311 "1\n"
2312 "1\n"
2313 "4\n"
2314 "7\n"
2315 "6\n"
2316 "2\n"
2317 "1\n"
2318 "5\n"
2319 "3\n"
2320 "8\n"
2321 "4\n"
2322 "2\n"
2323 "3\n"
2324 "2\n"
2325 "4\n"
2326 "6\n"
2327 "1\n"
2328 "4\n"
2329 "3\n"
2330 "2\n"
2331 "1\n"
2332 "2\n"
2333 "3\n"
2334 "4\n"
2335 "3\n"
2336 "10\n"
2337 "1\n"
2338 "1\n"
2339 "2\n"
2340 "2\n"
2341 "4\n"
2342 "1\n"
2343 "5\n"
2344 "5\n"
2345 "3\n"
2346 "1\n"
2347 "1\n"
2348 "3\n"
2349 "1\n"
2350 "2\n"
2351 "3\n"
2352 "3\n"
2353 "1\n"
2354 "1\n"
2355 "3\n"
2356 "5\n"
2357 "4\n"
2358 "4\n"
2359 "1\n"
2360 "3\n"
2361 "4\n"
2362 "1\n"
2363 "3\n"
2364 "4\n"
2365 "2\n"
2366 "1\n"
2367 "2\n"
2368 "4\n"
2369 "3\n"
2370 "3\n"
2371 "2\n"
2372 "2\n"
2373 "8\n"
2374 "4\n"
2375 "3\n"
2376 "1\n"
2377 "1\n"
2378 "1\n"
2379 "5\n"
2380 "5\n"
2381 "8\n"
2382 "1\n"
2383 "1\n"
2384 "7\n"
2385 "9\n"
2386 "2\n"
2387 "1\n"
2388 "4\n"
2389 "3\n"
2390 "1\n"
2391 "4\n"
2392 "1\n"
2393 "2\n"
2394 "1\n"
2395 "4\n"
2396 "2\n"
2397 "4\n"
2398 "1\n"
2399 "1\n",
2400 ans);
2401 }
2402 }// namespace acwing3380
2403
2407 namespace acwing3377 {
2408 TEST(acwing3377, case1) {
2409 istringstream in("5\n"
2410 "1 3 4 6 12");
2411 auto out = ostringstream();
2412 main(in, out);
2413 const auto ans = out.str();
2414 ASSERT_EQ("1\n"
2415 "2\n"
2416 "3\n"
2417 "4\n"
2418 "6\n",
2419 ans);
2420 }
2421 }// namespace acwing3377
2422
2426 namespace acwing3507 {
2427 TEST(acwing3507, case1) {
2428 istringstream in("5");
2429 auto out = ostringstream();
2430 main(in, out);
2431 const auto ans = out.str();
2432 ASSERT_EQ("1",
2433 ans);
2434 }
2435
2436 TEST(acwing3507, case2) {
2437 istringstream in("417918803");
2438 auto out = ostringstream();
2439 main(in, out);
2440 const auto ans = out.str();
2441 ASSERT_EQ("104479694", ans);
2442 }
2443 }// namespace acwing3507
2444
2448 namespace acwing3484 {
2449 TEST(acwing3484, case1) {
2450 istringstream in("6 10");
2451 auto out = ostringstream();
2452 main(in, out);
2453 const auto ans = out.str();
2454 ASSERT_EQ("1", ans);
2455 }
2456
2457 TEST(acwing3484, case2) {
2458 istringstream in("519 453");
2459 auto out = ostringstream();
2460 main(in, out);
2461 const auto ans = out.str();
2462 ASSERT_EQ("3", ans);
2463 }
2464
2465 TEST(acwing3484, case3) {
2466 istringstream in("339 9");
2467 auto out = ostringstream();
2468 main(in, out);
2469 const auto ans = out.str();
2470 ASSERT_EQ("83", ans);
2471 }
2472 }// namespace acwing3484
2473}// namespace acwing
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:24
TEST(acwing3378, case1)
TEST(acwing3376, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:54
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:76
TEST(acwing3374, case1)
TEST(acwing3757, case1)
void rearrangedList(struct ListNode *head)
Definition: acwing408.cpp:125
TEST(acwing3607, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:161
TEST(acwing3573, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:196
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:223
TEST(acwing3302_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:325
TEST(acwing148, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:375
TEST(acwing836_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:441
TEST(acwing3786, case1)
TEST(acwing149, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:536
TEST(acwing831_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:601
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:624
TEST(acwing3385, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:680
TEST(acwing3429, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:712
TEST(acwing858_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:764
TEST(acwing849_408, case1)
TEST(acwing854_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:808
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:846
TEST(acwing848_408, case1)
TEST(acwing3402, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:892
TEST(acwing3472, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1028
TEST(acwing3439, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1047
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1070
TEST(acwing3379, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1084
TEST(acwing3390, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1110
TEST(acwing3397, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1154
TEST(acwing3426, case1)
TEST(acwing3406, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1186
TEST(acwing3447, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1213
int findMissMin(vector< int > &nums)
Definition: acwing408.cpp:1241
TEST(acwing3820, case1)
TEST(acwing840_408, case2)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1255
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1286
TEST(acwing3542, case1)
TEST(acwing3542, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1307
TEST(acwing785_408, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1354
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1373
TEST(acwing3504, case1)
TEST(acwing1603, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1403
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1443
TEST(acwing3527, case1)
TEST(acwing3534, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1509
TEST(acwing3535, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1554
TEST(acwing3874, case2)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1607
TEST(acwing52, case1)
int moreThanHalfNum_Solution(vector< int > &nums)
Definition: acwing408.cpp:1679
TEST(acwing3392, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1702
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1719
TEST(acwing3392, case2)
TEST(acwing3441, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1766
TEST(acwing2, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1806
TEST(acwing3445, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1839
TEST(acwing3442, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1874
TEST(acwing3382, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1900
TEST(acwing3389, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1919
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1942
TEST(acwing3448, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:1976
TEST(acwing3448, case1)
TEST(acwing3380, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:2002
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:2024
TEST(acwing3377, case1)
TEST(acwing3507, case1)
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:2052
int main(istream &cin, ostream &cout)
Definition: acwing408.cpp:2072
TEST(acwing3484, case1)