Codeforces Round 520 (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
1062 Codeforces Round 520 (Div. 2) FINISHED False 7200 195315923 Nov. 14, 2018, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5535 ) C Banh-mi PROGRAMMING greedy implementation math 1600

B"JATC loves Banh-mi (a Vietnamese food). His affection for Banh-mi is so much that he always has it for breakfast. This morning, as usual, he buys a Banh-mi and decides to enjoy it in a special way. First, he splits the Banh-mi into n parts, places them on a row and numbers them from 1 through n . For each part i , he defines the deliciousness of the part as x_i in {0, 1 } . JATC's going to eat those parts one by one. At each step, he chooses arbitrary remaining part and eats it. Suppose that part is the i -th part then his enjoyment of the Banh-mi will increase by x_i and the deliciousness of all the remaining parts will also increase by x_i . The initial enjoyment of JATC is equal to 0 . For example, suppose the deliciousness of 3 parts are [0, 1, 0] . If JATC eats the second part then his enjoyment will become 1 and the deliciousness of remaining parts will become [1, _, 1] . Next, if he eats the first part then his enjoyment will become 2 and the remaining parts will become [ _, _, 2] . After eating the last part, JATC's enjoyment will become 4 . However, JATC doesn't want to eat all the parts but to save some for later. He gives you q queries, each of them consisting of two integers l_i and r_i . For each query, you have to let him know what is the maximum enjoyment he can get if he eats all the parts with indices in the range [l_i, r_i] in some order. All the queries are independent of each other. Since the answer to the query could be very large, print it modulo 10^9+7 . The first line contains two integers n and q ( 1 <= n, q <= 100 ,000 ). The second line contains a string of n characters, each character is either '0' or '1'. The i -th character defines the deliciousness of the i -th part. Each of the following q lines contains two integers l_i and r_i ( 1 <= l_i <= r_i <= n$$"...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
53652787 vjudge5 C May 2, 2019, 2:36 a.m. OK Clang++17 Diagnostics TESTS 27 140 0 1600
45787218 Xie-Weijie C Nov. 16, 2018, 3:16 a.m. OK Clang++17 Diagnostics TESTS 27 904 10035200 1600
45759287 Khanh_Moriaty C Nov. 15, 2018, 8:05 a.m. OK FPC TESTS 27 327 3072000 1600
53272969 chaorenhaha C April 25, 2019, 7:37 a.m. OK FPC TESTS 27 390 2150400 1600
46118091 wawac C Nov. 23, 2018, 2:52 p.m. OK GNU C11 TESTS 27 374 819200 1600
51600253 vjudge5 C March 21, 2019, 2:58 a.m. OK GNU C11 TESTS 27 405 1843200 1600
45738603 coderbd C Nov. 14, 2018, 5:25 p.m. OK GNU C11 TESTS 27 420 512000 1600
46649055 Jousero C Dec. 5, 2018, 1:09 p.m. OK GNU C11 TESTS 27 420 921600 1600
45878449 vjudge4 C Nov. 17, 2018, 12:57 p.m. OK GNU C11 TESTS 27 420 921600 1600
46680459 nhat286 C Dec. 6, 2018, 11:51 a.m. OK GNU C11 TESTS 27 421 409600 1600
46028713 SilverFire C Nov. 21, 2018, 12:38 p.m. OK GNU C11 TESTS 27 421 921600 1600
50345667 geeyiiz C Feb. 23, 2019, 6:12 a.m. OK GNU C11 TESTS 27 421 1228800 1600
45759224 MayankG C Nov. 15, 2018, 8:02 a.m. OK GNU C11 TESTS 27 421 8089600 1600
45739965 jasshangoel C Nov. 14, 2018, 5:32 p.m. OK GNU C11 TESTS 27 436 921600 1600
55985473 AlseoRoplyer C June 24, 2019, 2:57 a.m. OK GNU C++11 TESTS 27 46 921600 1600
46131393 Clao_015 C Nov. 24, 2018, 1:17 a.m. OK GNU C++11 TESTS 27 46 921600 1600
45733895 Canophia C Nov. 14, 2018, 4:59 p.m. OK GNU C++11 TESTS 27 46 1126400 1600
45762986 Rajib_119 C Nov. 15, 2018, 10:44 a.m. OK GNU C++11 TESTS 27 46 1331200 1600
45738527 skmonir C Nov. 14, 2018, 5:25 p.m. OK GNU C++11 TESTS 27 46 1331200 1600
45732126 sky48 C Nov. 14, 2018, 4:50 p.m. OK GNU C++11 TESTS 27 46 2150400 1600
50429163 shuidi C Feb. 24, 2019, 1:07 p.m. OK GNU C++11 TESTS 27 46 2662400 1600
59123065 luogu_bot3 C Aug. 20, 2019, 6:52 a.m. OK GNU C++11 TESTS 27 46 3174400 1600
59123320 Icookie C Aug. 20, 2019, 7:03 a.m. OK GNU C++11 TESTS 27 46 3174400 1600
46131349 fwat C Nov. 24, 2018, 1:13 a.m. OK GNU C++11 TESTS 27 46 3276800 1600
45761108 great_influence C Nov. 15, 2018, 9:08 a.m. OK GNU C++14 TESTS 27 31 17715200 1600
45793671 JKa8neFF C Nov. 16, 2018, 9 a.m. OK GNU C++14 TESTS 27 46 2662400 1600
45733468 notking1 C Nov. 14, 2018, 4:57 p.m. OK GNU C++14 TESTS 27 62 1331200 1600
45733502 nafi3000 C Nov. 14, 2018, 4:57 p.m. OK GNU C++14 TESTS 27 62 1331200 1600
51819749 pvannvuILQD C March 25, 2019, 11:26 a.m. OK GNU C++14 TESTS 27 77 819200 1600
45773172 Single_Ready_To_Mingle C Nov. 15, 2018, 3:36 p.m. OK GNU C++14 TESTS 27 77 921600 1600
45785714 k0walsk1 C Nov. 16, 2018, 1:15 a.m. OK GNU C++14 TESTS 27 77 921600 1600
48921293 flying_turtle C Jan. 25, 2019, 7:59 a.m. OK GNU C++14 TESTS 27 77 1024000 1600
58123468 vjudge1 C Aug. 1, 2019, 11:43 a.m. OK GNU C++14 TESTS 27 77 1126400 1600
47776001 gfonn C Dec. 31, 2018, 3:53 a.m. OK GNU C++14 TESTS 27 77 1228800 1600
45762280 xuziye0327 C Nov. 15, 2018, 9:51 a.m. OK GNU C++17 TESTS 27 62 1331200 1600
53566315 toysheeyeyraku C April 30, 2019, 12:37 p.m. OK GNU C++17 TESTS 27 77 921600 1600
49504717 lys1280023 C Feb. 5, 2019, 4:58 p.m. OK GNU C++17 TESTS 27 77 1126400 1600
45736630 hogeover30 C Nov. 14, 2018, 5:14 p.m. OK GNU C++17 TESTS 27 77 1126400 1600
45744798 saketh C Nov. 14, 2018, 7:39 p.m. OK GNU C++17 TESTS 27 77 1331200 1600
47443813 wassim.omais C Dec. 24, 2018, 4:34 a.m. OK GNU C++17 TESTS 27 77 1331200 1600
46020047 vjudge3 C Nov. 21, 2018, 7:20 a.m. OK GNU C++17 TESTS 27 77 1536000 1600
45756054 chenyeyuan C Nov. 15, 2018, 5:58 a.m. OK GNU C++17 TESTS 27 77 1638400 1600
49208630 Mitsuhaw C Jan. 30, 2019, 2:45 p.m. OK GNU C++17 TESTS 27 77 1945600 1600
49235096 Rose C Jan. 31, 2019, 7:35 a.m. OK GNU C++17 TESTS 27 77 2355200 1600
45844639 Zoli C Nov. 16, 2018, 6:59 p.m. OK Go TESTS 27 171 5222400 1600
45747317 Marii C Nov. 14, 2018, 8:52 p.m. OK Go TESTS 27 171 6144000 1600
45844433 Zoli C Nov. 16, 2018, 6:54 p.m. OK Go TESTS 27 498 5222400 1600
45991413 davidguandev C Nov. 20, 2018, 10:07 a.m. OK Go TESTS 27 514 5324800 1600
68417007 TheCerberus C Jan. 8, 2020, 7:23 p.m. OK Java 11 TESTS 27 249 0 1600
67987872 betcHajosHingjosH C Dec. 31, 2019, 1:15 a.m. OK Java 11 TESTS 27 296 0 1600
47192245 abhi2601 C Dec. 18, 2018, 12:49 p.m. OK Java 8 TESTS 27 140 0 1600
52268687 MaxHeap C April 3, 2019, 12:21 p.m. OK Java 8 TESTS 27 140 0 1600
46124243 NatInTheHat C Nov. 23, 2018, 6:04 p.m. OK Java 8 TESTS 27 155 0 1600
45848362 moinul.shaon C Nov. 16, 2018, 8:59 p.m. OK Java 8 TESTS 27 155 0 1600
45743780 BNL C Nov. 14, 2018, 7:19 p.m. OK Java 8 TESTS 27 155 0 1600
45731476 jonsnow7 C Nov. 14, 2018, 4:46 p.m. OK Java 8 TESTS 27 155 0 1600
46483569 Omar_Morsi C Dec. 2, 2018, 9:16 a.m. OK Java 8 TESTS 27 155 0 1600
68414863 TheCerberus C Jan. 8, 2020, 6:25 p.m. OK Java 8 TESTS 27 156 0 1600
52531813 xodiac C April 9, 2019, 1:46 p.m. OK Java 8 TESTS 27 156 0 1600
46925448 sooraj10 C Dec. 12, 2018, 8:20 a.m. OK Java 8 TESTS 27 156 0 1600
58528927 og.kostya C Aug. 10, 2019, 8:32 a.m. OK Mono C# TESTS 27 93 4198400 1600
45795470 leign C Nov. 16, 2018, 10:25 a.m. OK Mono C# TESTS 27 139 11366400 1600
46052785 treasuryonly C Nov. 22, 2018, 8:52 a.m. OK Mono C# TESTS 27 140 7372800 1600
45734749 Zvigintsev C Nov. 14, 2018, 5:04 p.m. OK Mono C# TESTS 27 155 12492800 1600
46905538 Mem C Dec. 11, 2018, 2:03 p.m. OK Mono C# TESTS 27 249 16281600 1600
45939698 niquefa_diego C Nov. 18, 2018, 6:50 p.m. OK Mono C# TESTS 27 498 3686400 1600
45746991 Coder_D C Nov. 14, 2018, 8:40 p.m. OK Mono C# TESTS 27 732 4403200 1600
45733352 Roverandom C Nov. 14, 2018, 4:56 p.m. OK Mono C# TESTS 27 764 7680000 1600
45738479 artworks C Nov. 14, 2018, 5:25 p.m. OK Mono C# TESTS 27 779 7680000 1600
45735024 omikad C Nov. 14, 2018, 5:06 p.m. OK Mono C# TESTS 27 794 8499200 1600
45902531 cuk123 C Nov. 18, 2018, 6:12 a.m. OK MS C++ TESTS 27 62 921600 1600
45752492 AsahiKokura C Nov. 15, 2018, 2:45 a.m. OK MS C++ TESTS 27 62 1740800 1600
45756805 vjudge3 C Nov. 15, 2018, 6:28 a.m. OK MS C++ TESTS 27 77 1740800 1600
46438563 vjudge2 C Dec. 1, 2018, 10:40 a.m. OK MS C++ TESTS 27 93 6656000 1600
45739866 TimeVShow C Nov. 14, 2018, 5:31 p.m. OK MS C++ TESTS 27 93 16998400 1600
45756940 vjudge2 C Nov. 15, 2018, 6:34 a.m. OK MS C++ TESTS 27 108 6144000 1600
51920048 vjudge1 C March 28, 2019, 3:19 a.m. OK MS C++ TESTS 27 109 512000 1600
46359704 vjudge5 C Nov. 29, 2018, 10:27 a.m. OK MS C++ TESTS 27 109 512000 1600
46019693 vjudge1 C Nov. 21, 2018, 7:04 a.m. OK MS C++ TESTS 27 109 512000 1600
58171585 vjudge2 C Aug. 2, 2019, 11:33 a.m. OK MS C++ TESTS 27 124 409600 1600
62189030 AleksanderBalobanov C Oct. 9, 2019, 9:10 a.m. OK MS C++ 2017 TESTS 27 93 5836800 1600
58124041 vjudge3 C Aug. 1, 2019, 11:56 a.m. OK MS C++ 2017 TESTS 27 156 614400 1600
58113380 vjudge5 C Aug. 1, 2019, 8:03 a.m. OK MS C++ 2017 TESTS 27 171 614400 1600
58115322 vjudge1 C Aug. 1, 2019, 8:40 a.m. OK MS C++ 2017 TESTS 27 171 819200 1600
59044158 Still_Theory C Aug. 18, 2019, 3:47 p.m. OK MS C++ 2017 TESTS 27 296 614400 1600
55930992 petko_mitkov C June 22, 2019, 11:28 a.m. OK MS C++ 2017 TESTS 27 296 921600 1600
58126310 vjudge3 C Aug. 1, 2019, 12:42 p.m. OK MS C++ 2017 TESTS 27 482 2560000 1600
52528773 colacorn_cry C April 9, 2019, 12:38 p.m. OK MS C++ 2017 TESTS 27 483 1740800 1600
49851838 llolitay C Feb. 13, 2019, 4:27 a.m. OK MS C++ 2017 TESTS 27 499 17203200 1600
49553972 nqbinh17 C Feb. 7, 2019, 8:21 a.m. OK MS C++ 2017 TESTS 27 545 1843200 1600
45749953 sk0 C Nov. 14, 2018, 11:35 p.m. OK Ocaml TESTS 27 530 4812800 1600
45749975 sk0 C Nov. 14, 2018, 11:37 p.m. OK Ocaml TESTS 27 561 4812800 1600
45750175 sk0 C Nov. 14, 2018, 11:56 p.m. OK Ocaml TESTS 27 623 4812800 1600
45750232 sk0 C Nov. 15, 2018, 12:01 a.m. OK Ocaml TESTS 27 624 4812800 1600
45734150 sk0 C Nov. 14, 2018, 5:01 p.m. OK Ocaml TESTS 27 811 4812800 1600
45749905 sk0 C Nov. 14, 2018, 11:31 p.m. OK Ocaml TESTS 27 826 4812800 1600
46641498 Jonte_98 C Dec. 5, 2018, 9:57 a.m. OK PyPy 2 TESTS 27 218 14950400 1600
45733801 Mukundan314 C Nov. 14, 2018, 4:59 p.m. OK PyPy 2 TESTS 27 482 11776000 1600
45733337 c1729 C Nov. 14, 2018, 4:56 p.m. OK PyPy 2 TESTS 27 483 11673600 1600
46643824 Jonte_98 C Dec. 5, 2018, 11:10 a.m. OK PyPy 2 TESTS 27 545 15462400 1600
46641339 Jonte_98 C Dec. 5, 2018, 9:50 a.m. OK PyPy 2 TESTS 27 701 12390400 1600
45765330 dhirajfx3 C Nov. 15, 2018, 11:52 a.m. OK PyPy 2 TESTS 27 826 3276800 1600
45802877 godmar C Nov. 16, 2018, 2:17 p.m. OK PyPy 2 TESTS 27 935 15769600 1600
46264440 nealzane C Nov. 27, 2018, 12:18 a.m. OK PyPy 2 TESTS 27 951 15974400 1600
45803217 frederika C Nov. 16, 2018, 2:27 p.m. OK PyPy 2 TESTS 27 966 10854400 1600
45794098 Mr_Emrul C Nov. 16, 2018, 9:18 a.m. OK PyPy 3 TESTS 27 327 8294400 1600
45765232 dhirajfx3 C Nov. 15, 2018, 11:49 a.m. OK PyPy 3 TESTS 27 327 8499200 1600
45765360 dhirajfx3 C Nov. 15, 2018, 11:52 a.m. OK PyPy 3 TESTS 27 343 8601600 1600
57191938 tchr C July 17, 2019, 10:57 a.m. OK PyPy 3 TESTS 27 389 12083200 1600
45738946 Paixao C Nov. 14, 2018, 5:27 p.m. OK PyPy 3 TESTS 27 405 8908800 1600
58130897 brosucks C Aug. 1, 2019, 2:14 p.m. OK PyPy 3 TESTS 27 405 11264000 1600
69518424 sureshsinghspd C Jan. 25, 2020, 12:43 p.m. OK PyPy 3 TESTS 27 436 9625600 1600
45746406 LordVader C Nov. 14, 2018, 8:23 p.m. OK PyPy 3 TESTS 27 561 9318400 1600
51563613 ygape1s C March 20, 2019, 8:53 a.m. OK PyPy 3 TESTS 27 592 11878400 1600
69662803 deadguy C Jan. 28, 2020, 10:08 a.m. OK PyPy 3 TESTS 27 592 76800000 1600
45737630 akshay125 C Nov. 14, 2018, 5:20 p.m. OK Python 2 TESTS 27 483 5222400 1600
48718886 ssk497 C Jan. 22, 2019, 12:39 p.m. OK Python 2 TESTS 27 498 6656000 1600
47886124 whatshisbucket C Jan. 3, 2019, 11:14 p.m. OK Python 2 TESTS 27 499 3584000 1600
45752988 biltharesatyendra C Nov. 15, 2018, 3:14 a.m. OK Python 2 TESTS 27 514 3584000 1600
45763188 raven_47 C Nov. 15, 2018, 10:48 a.m. OK Python 2 TESTS 27 514 4608000 1600
45743678 p4thet1c C Nov. 14, 2018, 7:18 p.m. OK Python 2 TESTS 27 530 10342400 1600
45739096 SoSooding C Nov. 14, 2018, 5:28 p.m. OK Python 2 TESTS 27 560 6451200 1600
47849973 ankurjain88 C Jan. 2, 2019, 5:06 p.m. OK Python 2 TESTS 27 561 5529600 1600
45737219 jaya_8896 C Nov. 14, 2018, 5:18 p.m. OK Python 2 TESTS 27 561 5529600 1600
45735285 radhikapillai25 C Nov. 14, 2018, 5:07 p.m. OK Python 2 TESTS 27 576 5836800 1600
45753878 ruterute1 C Nov. 15, 2018, 4:05 a.m. OK Python 3 TESTS 27 499 13824000 1600
45753844 ruterute1 C Nov. 15, 2018, 4:03 a.m. OK Python 3 TESTS 27 514 13004800 1600
45759758 crabentos C Nov. 15, 2018, 8:21 a.m. OK Python 3 TESTS 27 514 13824000 1600
45959857 Firepaw C Nov. 19, 2018, 11:09 a.m. OK Python 3 TESTS 27 576 13926400 1600
45742404 takumi152 C Nov. 14, 2018, 7 p.m. OK Python 3 TESTS 27 639 13107200 1600
45752481 prey176 C Nov. 15, 2018, 2:45 a.m. OK Python 3 TESTS 27 670 8704000 1600
49182033 lacrimak C Jan. 30, 2019, 2:41 a.m. OK Python 3 TESTS 27 717 5324800 1600
48051637 Liwj C Jan. 7, 2019, 9:31 a.m. OK Python 3 TESTS 27 732 5939200 1600
58956698 kekelol C Aug. 17, 2019, 1:19 p.m. OK Python 3 TESTS 27 748 8704000 1600
45738714 VTifand C Nov. 14, 2018, 5:26 p.m. OK Python 3 TESTS 27 748 9932800 1600

remove filters

Back to search problems