Codeforces Round 420 (Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
821 Codeforces Round 420 (Div. 2) FINISHED False 8100 239124324 June 25, 2017, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7014 ) C Okabe and Boxes PROGRAMMING data structures greedy trees 1600

B'Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack. Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw it in the trash. Okabe wants Daru to throw away the boxes in the order from 1 to n. Of course, this means that it might be impossible for Daru to perform some of Okabe 's remove commands, because the required box is not on the top of the stack. That 's why Daru can decide to wait until Okabe looks away and then reorder the boxes in the stack in any way he wants. He can do it at any point of time between Okabe 's commands, but he can 't add or remove boxes while he does it. Tell Daru the minimum number of times he needs to reorder the boxes so that he can successfully complete all of Okabe 's commands. It is guaranteed that every box is added before it is required to be removed. The first line of input contains the integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893 xc2 xb7105) -- the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guaranteed that exactly n lines contain "add" operations, all the boxes added are distinct, and n lines contain "remove" operations. It is also guaranteed that a box is always added before it is required to be removed. Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe 's commands. In the first sample, Daru should reorder the boxes after adding box 3 to the stack. In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. '...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
51407930 codemaster4 C March 17, 2019, 10:44 a.m. OK Clang++17 Diagnostics TESTS 89 499 9318400 1600
40171762 sakurakatana C July 10, 2018, 12:49 p.m. OK Clang++17 Diagnostics TESTS 89 701 14950400 1600
40216336 vjudge5 C July 12, 2018, 2:49 a.m. OK Clang++17 Diagnostics TESTS 89 702 14745600 1600
40171788 vjudge4 C July 10, 2018, 12:50 p.m. OK Clang++17 Diagnostics TESTS 89 717 14745600 1600
46886857 liusiyu123 C Dec. 11, 2018, 1:46 a.m. OK Clang++17 Diagnostics TESTS 89 2214 1740800 1600
46890113 liusiyu123 C Dec. 11, 2018, 5:14 a.m. OK Clang++17 Diagnostics TESTS 89 2496 1536000 1600
28061354 nanae1914 C June 26, 2017, 4:35 p.m. OK D TESTS 89 405 7168000 1600
28060986 nanae1914 C June 26, 2017, 4:04 p.m. OK D TESTS 89 733 5427200 1600
28036747 ruban C June 25, 2017, 4:18 p.m. OK Delphi TESTS 89 124 79462400 1600
29046298 vjudge5 C July 31, 2017, 11:17 a.m. OK FPC TESTS 89 171 2867200 1600
31604569 vjudge4 C Oct. 22, 2017, 1:06 p.m. OK FPC TESTS 89 171 2867200 1600
29046028 vjudge2 C July 31, 2017, 11:06 a.m. OK FPC TESTS 89 171 2867200 1600
29045745 vjudge3 C July 31, 2017, 10:52 a.m. OK FPC TESTS 89 171 2867200 1600
29046978 vjudge5 C July 31, 2017, 11:43 a.m. OK FPC TESTS 89 171 5632000 1600
29046112 vjudge4 C July 31, 2017, 11:10 a.m. OK FPC TESTS 89 186 2867200 1600
29045834 vjudge5 C July 31, 2017, 10:57 a.m. OK FPC TESTS 89 187 2867200 1600
29045638 vjudge2 C July 31, 2017, 10:48 a.m. OK FPC TESTS 89 187 2867200 1600
29045612 vjudge5 C July 31, 2017, 10:47 a.m. OK FPC TESTS 89 187 2867200 1600
29046960 vjudge2 C July 31, 2017, 11:43 a.m. OK FPC TESTS 89 187 5632000 1600
28159891 pelushe C June 29, 2017, 11:47 p.m. OK GNU C TESTS 89 78 3072000 1600
28048999 fsociety00 C June 26, 2017, 5 a.m. OK GNU C TESTS 89 171 3072000 1600
33535995 Ranadev_CaptainR C Dec. 23, 2017, 11:40 a.m. OK GNU C TESTS 89 171 3072000 1600
28059195 mananb31 C June 26, 2017, 2:05 p.m. OK GNU C TESTS 89 171 3072000 1600
28051672 KinKong1 C June 26, 2017, 7:29 a.m. OK GNU C TESTS 89 171 3072000 1600
28046141 sahuang C June 26, 2017, 12:52 a.m. OK GNU C TESTS 89 171 3072000 1600
28041728 rainboy C June 25, 2017, 6:20 p.m. OK GNU C TESTS 89 171 3072000 1600
28172178 koderliar C June 30, 2017, 12:52 p.m. OK GNU C TESTS 89 171 4608000 1600
28101223 MrCoderBoy C June 27, 2017, 6:08 p.m. OK GNU C TESTS 89 187 3072000 1600
28036411 Who1 C June 25, 2017, 4:15 p.m. OK GNU C TESTS 89 187 4300800 1600
28050466 xumingkuan C June 26, 2017, 6:29 a.m. OK GNU C++ TESTS 89 31 3174400 1600
40980632 ReaLNero1 C July 30, 2018, 5:37 p.m. OK GNU C++ TESTS 89 46 1126400 1600
31508717 vjudge5 C Oct. 19, 2017, 1:02 p.m. OK GNU C++ TESTS 89 46 3584000 1600
31508499 vjudge4 C Oct. 19, 2017, 12:55 p.m. OK GNU C++ TESTS 89 46 3584000 1600
28026472 xumingkuan C June 25, 2017, 3:01 p.m. OK GNU C++ TESTS 89 77 6553600 1600
28035266 Moon1125666900 C June 25, 2017, 4:04 p.m. OK GNU C++ TESTS 89 78 4300800 1600
28032038 alexm C June 25, 2017, 3:38 p.m. OK GNU C++ TESTS 89 93 3072000 1600
28467383 DFPMTS C July 12, 2017, 8:20 a.m. OK GNU C++ TESTS 89 124 3276800 1600
28048737 mengbierr C June 26, 2017, 4:40 a.m. OK GNU C++ TESTS 89 124 3481600 1600
28245434 orzccz C July 3, 2017, 6:01 a.m. OK GNU C++ TESTS 89 124 4300800 1600
51414958 codemaster4 C March 17, 2019, 1:37 p.m. OK GNU C11 TESTS 89 156 1228800 1600
51410848 codemaster4 C March 17, 2019, 11:59 a.m. OK GNU C11 TESTS 89 171 1228800 1600
28026629 Jeel_Vaishnav C June 25, 2017, 3:02 p.m. OK GNU C11 TESTS 89 171 3072000 1600
28042687 magieNoire C June 25, 2017, 7:02 p.m. OK GNU C11 TESTS 89 171 3891200 1600
40196531 vjudge4 C July 11, 2018, 9:32 a.m. OK GNU C11 TESTS 89 202 1536000 1600
63538679 ztx C Oct. 27, 2019, 8:54 a.m. OK GNU C++11 TESTS 89 46 1536000 1600
63544310 vjudge3 C Oct. 27, 2019, 10:09 a.m. OK GNU C++11 TESTS 89 46 1536000 1600
28044796 astinaam C June 25, 2017, 9:55 p.m. OK GNU C++11 TESTS 89 46 6860800 1600
28034412 mastermind_ C June 25, 2017, 3:57 p.m. OK GNU C++11 TESTS 89 78 3276800 1600
28044768 astinaam C June 25, 2017, 9:53 p.m. OK GNU C++11 TESTS 89 93 6860800 1600
69048791 vjudge2 C Jan. 18, 2020, 11:56 a.m. OK GNU C++11 TESTS 89 124 1536000 1600
28052092 Cherries C June 26, 2017, 7:48 a.m. OK GNU C++11 TESTS 89 124 3481600 1600
28046074 llgyc C June 26, 2017, 12:44 a.m. OK GNU C++11 TESTS 89 139 3276800 1600
28066030 supy C June 26, 2017, 11:55 p.m. OK GNU C++11 TESTS 89 139 3276800 1600
28044601 astinaam C June 25, 2017, 9:35 p.m. OK GNU C++11 TESTS 89 139 6860800 1600
28050404 xumingkuan C June 26, 2017, 6:25 a.m. OK GNU C++14 TESTS 89 46 3174400 1600
28034780 skdudn321 C June 25, 2017, 4 p.m. OK GNU C++14 TESTS 89 78 5529600 1600
28036969 rohank196196 C June 25, 2017, 4:20 p.m. OK GNU C++14 TESTS 89 124 3481600 1600
28048758 marcose18 C June 26, 2017, 4:42 a.m. OK GNU C++14 TESTS 89 124 3481600 1600
62562034 Priyam2k C Oct. 14, 2019, 12:15 p.m. OK GNU C++14 TESTS 89 139 1536000 1600
32196658 Gediminas C Nov. 10, 2017, 1:39 p.m. OK GNU C++14 TESTS 89 139 1536000 1600
31892798 black_well aayushkapadia uttam36 C Oct. 30, 2017, 12:09 p.m. OK GNU C++14 TESTS 89 139 1536000 1600
46202360 vjudge2 C Nov. 25, 2018, 12:14 p.m. OK GNU C++14 TESTS 89 139 1536000 1600
28941896 vjudge1 C July 28, 2017, 3:26 a.m. OK GNU C++14 TESTS 89 139 3481600 1600
28063757 Borisov C June 26, 2017, 7:25 p.m. OK GNU C++14 TESTS 89 139 3481600 1600
46768165 mblazev C Dec. 8, 2018, 3:26 p.m. OK GNU C++17 TESTS 89 140 1536000 1600
68996019 naimishsingh C Jan. 17, 2020, 5:25 p.m. OK GNU C++17 TESTS 89 140 1536000 1600
57481048 zhaoy1ping C July 22, 2019, 2:21 a.m. OK GNU C++17 TESTS 89 140 1536000 1600
57452582 ACACACACACACWACACACACAC C July 21, 2019, 10:17 a.m. OK GNU C++17 TESTS 89 140 1536000 1600
56147014 ishaan19 C June 27, 2019, 6:46 a.m. OK GNU C++17 TESTS 89 140 1536000 1600
55679712 Muskmelon_seed C June 17, 2019, 12:24 p.m. OK GNU C++17 TESTS 89 140 1536000 1600
52986887 sammithkanur C April 18, 2019, 7:20 p.m. OK GNU C++17 TESTS 89 140 1536000 1600
49864255 aesth C Feb. 13, 2019, 11:18 a.m. OK GNU C++17 TESTS 89 140 1536000 1600
44410944 vsriram1012 C Oct. 16, 2018, 4:44 p.m. OK GNU C++17 TESTS 89 140 1740800 1600
44181559 f4ded4k C Oct. 12, 2018, 11:31 a.m. OK GNU C++17 TESTS 89 140 1843200 1600
28035928 Leonardone C June 25, 2017, 4:10 p.m. OK Go TESTS 89 140 28672000 1600
28072015 ralekseenkov C June 27, 2017, 8:19 a.m. OK Go TESTS 89 140 43520000 1600
65889834 corelof C Nov. 28, 2019, 2:34 a.m. OK Go TESTS 89 498 10956800 1600
28029740 cojna C June 25, 2017, 3:23 p.m. OK Haskell TESTS 89 155 82432000 1600
28041731 sl0th C June 25, 2017, 6:20 p.m. OK Haskell TESTS 89 421 130150400 1600
28041801 sl0th C June 25, 2017, 6:22 p.m. OK Haskell TESTS 89 436 130150400 1600
28041670 sl0th C June 25, 2017, 6:18 p.m. OK Haskell TESTS 89 436 132198400 1600
28703633 gabe C July 19, 2017, 6:54 p.m. OK Haskell TESTS 89 1872 208896000 1600
28054341 uc-nuts C June 26, 2017, 9:38 a.m. OK Haskell TESTS 89 1933 213094400 1600
28037059 RP_9 C June 25, 2017, 4:21 p.m. OK Java 8 TESTS 89 171 20684800 1600
28059297 Mihir_Gajera1 C June 26, 2017, 2:12 p.m. OK Java 8 TESTS 89 202 20684800 1600
54779269 Vishal_dhanani C May 28, 2019, 8:07 p.m. OK Java 8 TESTS 89 217 1843200 1600
29133590 prakhar28 C Aug. 2, 2017, 2:52 p.m. OK Java 8 TESTS 89 217 20684800 1600
28032763 Golmol C June 25, 2017, 3:44 p.m. OK Java 8 TESTS 89 217 20684800 1600
67162770 thisbeit C Dec. 18, 2019, 2:30 p.m. OK Java 8 TESTS 89 218 1945600 1600
28049319 karanjobanputra C June 26, 2017, 5:23 a.m. OK Java 8 TESTS 89 218 20684800 1600
28074615 hitesh.bothra C June 27, 2017, 10:40 a.m. OK Java 8 TESTS 89 218 22937600 1600
28052271 Thacker C June 26, 2017, 7:57 a.m. OK Java 8 TESTS 89 218 23040000 1600
28043254 prashanth_rebala C June 25, 2017, 7:42 p.m. OK Java 8 TESTS 89 218 23756800 1600
28110087 dened C June 28, 2017, 7:20 a.m. OK Kotlin TESTS 89 218 23859200 1600
28031938 serejkee C June 25, 2017, 3:38 p.m. OK Kotlin TESTS 89 873 58777600 1600
28031853 leign C June 25, 2017, 3:37 p.m. OK Mono C# TESTS 89 233 13414400 1600
49940741 Mem C Feb. 15, 2019, 9:30 a.m. OK Mono C# TESTS 89 280 8806400 1600
28028521 riantkb C June 25, 2017, 3:15 p.m. OK Mono C# TESTS 89 280 17920000 1600
28042729 Drinker C June 25, 2017, 7:04 p.m. OK Mono C# TESTS 89 342 15360000 1600
28058481 sekiya9311 C June 26, 2017, 1:26 p.m. OK Mono C# TESTS 89 576 29081600 1600
28029280 og.kostya C June 25, 2017, 3:19 p.m. OK MS C# TESTS 89 109 13721600 1600
28030313 renadeen C June 25, 2017, 3:26 p.m. OK MS C# TESTS 89 186 16896000 1600
28026970 mircea85 C June 25, 2017, 3:04 p.m. OK MS C# TESTS 89 202 14745600 1600
28050416 artsin666 C June 26, 2017, 6:26 a.m. OK MS C# TESTS 89 234 13312000 1600
28029441 mike_4d C June 25, 2017, 3:21 p.m. OK MS C# TESTS 89 249 15872000 1600
28530540 Sorryforpartyrocking C July 13, 2017, 8:52 p.m. OK MS C# TESTS 89 280 16691200 1600
28058128 ShowStopper728 C June 26, 2017, 1:08 p.m. OK MS C# TESTS 89 280 18227200 1600
28033437 mban259 C June 25, 2017, 3:49 p.m. OK MS C# TESTS 89 312 41881600 1600
28454798 vitoshacademy C July 11, 2017, 9:55 p.m. OK MS C# TESTS 89 389 15872000 1600
28029942 Neverauskas C June 25, 2017, 3:24 p.m. OK MS C# TESTS 89 670 29184000 1600
45560452 vjudge5 C Nov. 11, 2018, 11:20 a.m. OK MS C++ TESTS 89 140 1228800 1600
63292410 vjudge5 C Oct. 24, 2019, 12:07 p.m. OK MS C++ TESTS 89 140 1228800 1600
48708679 vjudge5 C Jan. 22, 2019, 7:18 a.m. OK MS C++ TESTS 89 140 1228800 1600
45561393 vjudge5 C Nov. 11, 2018, 11:54 a.m. OK MS C++ TESTS 89 140 1228800 1600
63236880 vjudge2 C Oct. 23, 2019, 12:31 p.m. OK MS C++ TESTS 89 140 2150400 1600
45561126 vjudge2 C Nov. 11, 2018, 11:44 a.m. OK MS C++ TESTS 89 140 2252800 1600
48712665 vjudge1 C Jan. 22, 2019, 9:24 a.m. OK MS C++ TESTS 89 140 2252800 1600
45562832 vjudge2 C Nov. 11, 2018, 12:43 p.m. OK MS C++ TESTS 89 155 1228800 1600
63244121 vjudge2 C Oct. 23, 2019, 2:12 p.m. OK MS C++ TESTS 89 155 1228800 1600
63369281 vjudge3 C Oct. 25, 2019, 8:44 a.m. OK MS C++ TESTS 89 155 2048000 1600
51413070 codemaster4 C March 17, 2019, 12:52 p.m. OK MS C++ 2017 TESTS 89 233 2355200 1600
61840849 sdibt1 C Oct. 4, 2019, 9:36 a.m. OK MS C++ 2017 TESTS 89 249 2355200 1600
61840734 sdibt4 C Oct. 4, 2019, 9:33 a.m. OK MS C++ 2017 TESTS 89 264 2355200 1600
69052326 vjudge1 C Jan. 18, 2020, 1:11 p.m. OK MS C++ 2017 TESTS 89 326 2457600 1600
58841675 vjudge3 C Aug. 15, 2019, 2:26 a.m. OK MS C++ 2017 TESTS 89 405 3174400 1600
51408468 codemaster4 C March 17, 2019, 10:59 a.m. OK MS C++ 2017 TESTS 89 436 2969600 1600
63267078 HatsuneHan C Oct. 24, 2019, 1:06 a.m. OK MS C++ 2017 TESTS 89 452 1433600 1600
63335369 vjudge2 C Oct. 24, 2019, 4:54 p.m. OK MS C++ 2017 TESTS 89 452 4300800 1600
63267119 vjudge1 C Oct. 24, 2019, 1:08 a.m. OK MS C++ 2017 TESTS 89 468 1433600 1600
63382087 mirack C Oct. 25, 2019, 12:46 p.m. OK MS C++ 2017 TESTS 89 468 3174400 1600
28032124 mrthefakeperson C June 25, 2017, 3:39 p.m. OK PyPy 2 TESTS 89 639 30310400 1600
28174425 wika C June 30, 2017, 2:20 p.m. OK PyPy 2 TESTS 89 1372 25702400 1600
31922786 shubhu1596 wewakeprasad FatherofBenoni C Oct. 31, 2017, 1:31 p.m. OK PyPy 2 TESTS 89 1450 8601600 1600
28049239 anuj_shah C June 26, 2017, 5:17 a.m. OK PyPy 2 TESTS 89 1450 30310400 1600
28040896 JaniceV C June 25, 2017, 5:57 p.m. OK PyPy 2 TESTS 89 1466 30310400 1600
28044646 saathvik782 C June 25, 2017, 9:41 p.m. OK PyPy 2 TESTS 89 1497 30412800 1600
28061130 dasswapnil96 C June 26, 2017, 4:15 p.m. OK PyPy 2 TESTS 89 1590 30208000 1600
28038434 sragavan C June 25, 2017, 4:34 p.m. OK PyPy 2 TESTS 89 1825 34406400 1600
45203863 Vladyslav C Nov. 2, 2018, 11:38 a.m. OK PyPy 3 TESTS 89 654 55603200 1600
28212356 mattiasm83 C July 2, 2017, 2:37 p.m. OK PyPy 3 TESTS 89 904 43110400 1600
28048441 Punter C June 26, 2017, 4:19 a.m. OK PyPy 3 TESTS 89 919 30515200 1600
28041210 Ferume C June 25, 2017, 6:05 p.m. OK PyPy 3 TESTS 89 1044 37785600 1600
28042586 Blencer C June 25, 2017, 6:56 p.m. OK PyPy 3 TESTS 89 1060 73625600 1600
28042451 Pulitzer C June 25, 2017, 6:49 p.m. OK PyPy 3 TESTS 89 1060 73625600 1600
28030145 nwi C June 25, 2017, 3:25 p.m. OK Python 2 TESTS 89 468 11366400 1600
28041773 WNG C June 25, 2017, 6:21 p.m. OK Python 2 TESTS 89 811 9625600 1600
28068952 pythonpro C June 27, 2017, 5:38 a.m. OK Python 2 TESTS 89 826 11366400 1600
28032218 Skand C June 25, 2017, 3:40 p.m. OK Python 2 TESTS 89 826 21299200 1600
28052292 Ostkaka C June 26, 2017, 7:58 a.m. OK Python 2 TESTS 89 873 21299200 1600
28497735 saipreetham08 C July 13, 2017, 9:31 a.m. OK Python 2 TESTS 89 904 21504000 1600
28032953 2390_ C June 25, 2017, 3:45 p.m. OK Python 2 TESTS 89 919 21504000 1600
28042182 elistark C June 25, 2017, 6:37 p.m. OK Python 2 TESTS 89 936 21504000 1600
28029465 KiPu C June 25, 2017, 3:21 p.m. OK Python 2 TESTS 89 951 16588800 1600
28820436 brightlymale C July 24, 2017, 9:21 a.m. OK Python 2 TESTS 89 1029 11161600 1600
45203837 Vladyslav C Nov. 2, 2018, 11:37 a.m. OK Python 3 TESTS 89 670 50278400 1600
28032528 L1va C June 25, 2017, 3:42 p.m. OK Python 3 TESTS 89 701 12185600 1600
45203797 Vladyslav C Nov. 2, 2018, 11:36 a.m. OK Python 3 TESTS 89 764 53145600 1600
44328141 nowyyz C Oct. 14, 2018, 5 p.m. OK Python 3 TESTS 89 1123 7475200 1600
53903885 ayejayys C May 9, 2019, 11:44 a.m. OK Python 3 TESTS 89 1153 6451200 1600
48110087 indianfootball C Jan. 9, 2019, 8:48 a.m. OK Python 3 TESTS 89 1154 7987200 1600
45498898 vjudge4 C Nov. 10, 2018, 5:21 a.m. OK Python 3 TESTS 89 1185 7475200 1600
28110034 bahumajanu C June 28, 2017, 7:17 a.m. OK Python 3 TESTS 89 1231 12800000 1600
46257877 paul_infinity C Nov. 26, 2018, 5:57 p.m. OK Python 3 TESTS 89 1278 8396800 1600
28033202 JustAni C June 25, 2017, 3:47 p.m. OK Python 3 TESTS 89 1294 12185600 1600
29302982 Hillmouse C Aug. 9, 2017, 10 a.m. OK Rust TESTS 89 217 2662400 1600
28060024 cojna C June 26, 2017, 2:55 p.m. OK Rust TESTS 89 343 4710400 1600
28168461 jiangzhijie C June 30, 2017, 9:15 a.m. OK Rust TESTS 89 358 56422400 1600
28168379 jiangzhijie C June 30, 2017, 9:11 a.m. OK Rust TESTS 89 436 60313600 1600
28168205 jiangzhijie C June 30, 2017, 9:03 a.m. OK Rust TESTS 89 436 65024000 1600
28042085 mysterion C June 25, 2017, 6:33 p.m. OK Scala TESTS 89 452 28979200 1600
28031792 wrick C June 25, 2017, 3:37 p.m. OK Scala TESTS 89 842 57241600 1600

remove filters

Back to search problems