Codeforces Round 660 (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
1388 Codeforces Round 660 (Div. 2) FINISHED False 7200 141060263 July 30, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6506 ) D Captain Flint and Treasure PROGRAMMING data structures dfs and similar dp graphs greedy implementation trees 2000

B"Captain Fint is involved in another treasure hunt, but have found only one strange problem. The problem may be connected to the treasure's location or may not. That's why captain Flint decided to leave the solving the problem to his crew and offered an absurdly high reward: one day off. The problem itself sounds like this... There are two arrays a and b of length n . Initially, an ans is equal to 0 and the following operation is defined: What is the maximum ans you can get by performing the operation on each i ( 1 <= i <= n ) exactly once? Uncle Bogdan is eager to get the reward, so he is asking your help to find the optimal order of positions to perform the operation on them. The first line contains the integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of arrays a and b . The second line contains n integers a_1, a_2, ldots, a_n ( xe2 x88 x9210^6 <= a_i <= 10^6 ). The third line contains n integers b_1, b_2, ldots, b_n ( 1 <= b_i <= n or b_i = -1 ). Additional constraint: it's guaranteed that for any i ( 1 <= i <= n ) the sequence b_i, b_{b_i}, b_{b_{b_i}}, ldots is not cyclic, in other words it will always end with -1 . In the first line, print the maximum ans you can get. In the second line, print the order of operations: n different integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ). The p_i is the position which should be chosen at the i -th step. If there are multiple orders, print any of them. "...

Tutorials

Codeforces Round #660 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
88760288 gxlois D Aug. 2, 2020, 8:52 p.m. OK D TESTS 103 389 56217600 2000
88786795 dyxx D Aug. 3, 2020, 9:28 a.m. OK GNU C11 TESTS 103 826 25292800 2000
89476815 ybw051114 D Aug. 10, 2020, 3:36 a.m. OK GNU C++11 TESTS 103 62 10035200 2000
88789406 huangxiaohua D Aug. 3, 2020, 10:16 a.m. OK GNU C++11 TESTS 103 62 11571200 2000
89329227 zhangkai D Aug. 8, 2020, 11:10 a.m. OK GNU C++11 TESTS 103 62 13516800 2000
90732807 Adelard D Aug. 23, 2020, 6:50 a.m. OK GNU C++11 TESTS 103 78 9830400 2000
89297473 luogu_bot1 D Aug. 8, 2020, 1:27 a.m. OK GNU C++11 TESTS 103 78 11161600 2000
90279353 uuku D Aug. 18, 2020, 5:46 a.m. OK GNU C++11 TESTS 103 93 7168000 2000
90279361 bmh2017zzkzzk D Aug. 18, 2020, 5:46 a.m. OK GNU C++11 TESTS 103 93 8089600 2000
88764412 Vxlimo D Aug. 3, 2020, 12:20 a.m. OK GNU C++11 TESTS 103 93 8601600 2000
88837414 LMB D Aug. 4, 2020, 3:21 a.m. OK GNU C++11 TESTS 103 93 10035200 2000
89839189 luogu_bot2 D Aug. 14, 2020, 3:59 a.m. OK GNU C++11 TESTS 103 93 10649600 2000
89736312 ritesh1340 D Aug. 12, 2020, 6:32 p.m. OK GNU C++14 TESTS 103 170 8089600 2000
88829007 lincolnx D Aug. 3, 2020, 9:05 p.m. OK GNU C++14 TESTS 103 170 9830400 2000
90453364 kipple D Aug. 20, 2020, 10:19 a.m. OK GNU C++14 TESTS 103 171 5734400 2000
89809164 nikhil_cf D Aug. 13, 2020, 3:44 p.m. OK GNU C++14 TESTS 103 171 7065600 2000
91305477 mk_Shahriar D Aug. 29, 2020, 6:20 p.m. OK GNU C++14 TESTS 103 171 7475200 2000
88772307 Torta D Aug. 3, 2020, 4:56 a.m. OK GNU C++14 TESTS 103 171 8601600 2000
89084637 silxi D Aug. 6, 2020, 3:58 a.m. OK GNU C++14 TESTS 103 171 10854400 2000
90071394 SRIKANTH D Aug. 16, 2020, 9:26 a.m. OK GNU C++14 TESTS 103 171 11468800 2000
90724273 Willem D Aug. 23, 2020, 3:07 a.m. OK GNU C++14 TESTS 103 171 11468800 2000
88829734 FromDihPout D Aug. 3, 2020, 9:31 p.m. OK GNU C++14 TESTS 103 171 14643200 2000
88873981 Trisolaris D Aug. 4, 2020, 1:22 p.m. OK GNU C++17 TESTS 103 108 16793600 2000
89798122 Clouder0 D Aug. 13, 2020, 1:29 p.m. OK GNU C++17 TESTS 103 109 10854400 2000
90905388 Mr__Red D Aug. 25, 2020, 1:59 p.m. OK GNU C++17 TESTS 103 170 9728000 2000
90404026 Rainer1116 D Aug. 19, 2020, 3:53 p.m. OK GNU C++17 TESTS 103 171 4300800 2000
89364788 monkeyOnTypewriter D Aug. 8, 2020, 10:06 p.m. OK GNU C++17 TESTS 103 171 8704000 2000
88737381 zzq229 D Aug. 2, 2020, 2:12 p.m. OK GNU C++17 TESTS 103 171 9728000 2000
88845509 out111 D Aug. 4, 2020, 6:19 a.m. OK GNU C++17 TESTS 103 171 9830400 2000
88738200 _justsomeguy_ D Aug. 2, 2020, 2:24 p.m. OK GNU C++17 TESTS 103 171 9830400 2000
88872227 M...... D Aug. 4, 2020, 1:01 p.m. OK GNU C++17 TESTS 103 171 10240000 2000
88907816 igba D Aug. 5, 2020, 12:57 a.m. OK GNU C++17 TESTS 103 171 10240000 2000
89378762 ...._.._ D Aug. 9, 2020, 6:46 a.m. OK GNU C++17 (64) TESTS 103 62 19865600 2000
88900038 Naumovich D Aug. 4, 2020, 7:33 p.m. OK GNU C++17 (64) TESTS 103 124 10752000 2000
89181977 sayanmedya D Aug. 7, 2020, 7:07 a.m. OK GNU C++17 (64) TESTS 103 124 12083200 2000
89541021 MotoForces D Aug. 11, 2020, 1:02 a.m. OK GNU C++17 (64) TESTS 103 124 14745600 2000
88934991 Koo_ D Aug. 5, 2020, 10:03 a.m. OK GNU C++17 (64) TESTS 103 124 15360000 2000
89058276 MostafaAbdalla D Aug. 5, 2020, 5:30 p.m. OK GNU C++17 (64) TESTS 103 124 15564800 2000
89095149 kotamanegi D Aug. 6, 2020, 7:06 a.m. OK GNU C++17 (64) TESTS 103 124 15974400 2000
89141430 Capitan D Aug. 6, 2020, 4:16 p.m. OK GNU C++17 (64) TESTS 103 124 15974400 2000
88812755 Prostoegor239 D Aug. 3, 2020, 3:39 p.m. OK GNU C++17 (64) TESTS 103 124 16076800 2000
89573019 Aris D Aug. 11, 2020, 11:36 a.m. OK GNU C++17 (64) TESTS 103 124 16793600 2000
88831125 Richard727 D Aug. 3, 2020, 10:34 p.m. OK Java 11 TESTS 103 358 44646400 2000
88830797 shankha123 D Aug. 3, 2020, 10:17 p.m. OK Java 11 TESTS 103 374 40243200 2000
88759142 dpark3542 D Aug. 2, 2020, 8:17 p.m. OK Java 11 TESTS 103 389 40652800 2000
89153506 devesh08 D Aug. 6, 2020, 7:08 p.m. OK Java 11 TESTS 103 404 63692800 2000
89153282 devesh08 D Aug. 6, 2020, 7:04 p.m. OK Java 11 TESTS 103 421 63692800 2000
88830604 shankha123 D Aug. 3, 2020, 10:08 p.m. OK Java 11 TESTS 103 452 39321600 2000
88925912 anshum_it_is D Aug. 5, 2020, 7:44 a.m. OK Java 11 TESTS 103 468 82227200 2000
88891695 idk321 D Aug. 4, 2020, 5:10 p.m. OK Java 11 TESTS 103 499 59187200 2000
88939250 Witless_Deer D Aug. 5, 2020, 11:08 a.m. OK Java 11 TESTS 103 576 97587200 2000
90792215 UD_xlinsist D Aug. 24, 2020, 3:16 a.m. OK Java 11 TESTS 103 577 104755200 2000
90895079 vlad.iftimescu D Aug. 25, 2020, 11:35 a.m. OK Java 8 TESTS 103 343 32563200 2000
89054800 yaoct D Aug. 5, 2020, 5:01 p.m. OK Java 8 TESTS 103 405 117248000 2000
88897294 revanthreddy85 D Aug. 4, 2020, 6:38 p.m. OK Java 8 TESTS 103 421 91750400 2000
91051034 procrastinate7 D Aug. 26, 2020, 12:35 p.m. OK Java 8 TESTS 103 467 47206400 2000
88812785 godxpunk D Aug. 3, 2020, 3:40 p.m. OK Java 8 TESTS 103 483 138547200 2000
90196796 amolpratap007 D Aug. 17, 2020, 5:40 a.m. OK Java 8 TESTS 103 546 115507200 2000
88851375 elkadymohammed01 D Aug. 4, 2020, 7:46 a.m. OK Java 8 TESTS 103 561 157184000 2000
89342005 shivansh_6801 D Aug. 8, 2020, 2:21 p.m. OK Java 8 TESTS 103 623 131686400 2000
88866732 hulk_man D Aug. 4, 2020, 11:50 a.m. OK Java 8 TESTS 103 654 95232000 2000
88832696 O_E D Aug. 4, 2020, 12:10 a.m. OK Java 8 TESTS 103 670 93696000 2000
88880356 wuchaojie925 D Aug. 4, 2020, 2:39 p.m. OK Kotlin TESTS 103 280 35737600 2000
88879790 wuchaojie925 D Aug. 4, 2020, 2:32 p.m. OK Kotlin TESTS 103 326 35532800 2000
88879439 wuchaojie925 D Aug. 4, 2020, 2:28 p.m. OK Kotlin TESTS 103 327 34304000 2000
88877446 wuchaojie925 D Aug. 4, 2020, 2:04 p.m. OK Kotlin TESTS 103 327 34508800 2000
88877565 wuchaojie925 D Aug. 4, 2020, 2:05 p.m. OK Kotlin TESTS 103 327 35532800 2000
88876588 wuchaojie925 D Aug. 4, 2020, 1:53 p.m. OK Kotlin TESTS 103 436 43827200 2000
88876913 wuchaojie925 D Aug. 4, 2020, 1:57 p.m. OK Kotlin TESTS 103 467 44646400 2000
88877001 wuchaojie925 D Aug. 4, 2020, 1:58 p.m. OK Kotlin TESTS 103 514 44032000 2000
88858906 proBoi D Aug. 4, 2020, 9:38 a.m. OK Kotlin TESTS 103 873 180121600 2000
88858332 proBoi D Aug. 4, 2020, 9:29 a.m. OK Kotlin TESTS 103 935 181862400 2000
88752981 Mosyagin D Aug. 2, 2020, 5:55 p.m. OK Mono C# TESTS 103 857 49766400 2000
89844298 azukun D Aug. 14, 2020, 5:48 a.m. OK Mono C# TESTS 103 1076 194764800 2000
89493408 vjudge4 D Aug. 10, 2020, 8:25 a.m. OK MS C++ 2017 TESTS 103 218 16486400 2000
88824552 TMHazem D Aug. 3, 2020, 7:04 p.m. OK MS C++ 2017 TESTS 103 218 16793600 2000
88777658 rhksdn6227 D Aug. 3, 2020, 6:53 a.m. OK MS C++ 2017 TESTS 103 452 10444800 2000
90285867 dixmw34 D Aug. 18, 2020, 7:27 a.m. OK MS C++ 2017 TESTS 103 483 6553600 2000
89496725 dixmw34 D Aug. 10, 2020, 9:19 a.m. OK MS C++ 2017 TESTS 103 483 13824000 2000
88758600 savinovalex D Aug. 2, 2020, 8:03 p.m. OK MS C++ 2017 TESTS 103 483 16896000 2000
88822086 prosto_user D Aug. 3, 2020, 6:11 p.m. OK MS C++ 2017 TESTS 103 514 23756800 2000
88740597 pandoomanda D Aug. 2, 2020, 2:57 p.m. OK MS C++ 2017 TESTS 103 530 22220800 2000
89787018 yumtam D Aug. 13, 2020, 11:07 a.m. OK PyPy 2 TESTS 103 374 32665600 2000
88906364 daikisuyama D Aug. 4, 2020, 11:29 p.m. OK PyPy 3 TESTS 103 811 73318400 2000
91591853 Tomii9273 D Sept. 1, 2020, 6:15 p.m. OK PyPy 3 TESTS 103 842 48537600 2000
89196313 Xynos D Aug. 7, 2020, 10:34 a.m. OK PyPy 3 TESTS 103 919 72499200 2000
90322540 ulyss D Aug. 18, 2020, 3:29 p.m. OK PyPy 3 TESTS 103 982 64204800 2000
88791031 DeepBorys D Aug. 3, 2020, 10:44 a.m. OK PyPy 3 TESTS 103 1122 80076800 2000
88935629 devesh1102 D Aug. 5, 2020, 10:13 a.m. OK PyPy 3 TESTS 103 1372 114380800 2000
88735560 hansirchen D Aug. 2, 2020, 1:44 p.m. OK Python 3 TESTS 103 904 54067200 2000
88849766 trieule95 D Aug. 4, 2020, 7:24 a.m. OK Python 3 TESTS 103 1013 36249600 2000
89721494 student_learner D Aug. 12, 2020, 4:22 p.m. OK Python 3 TESTS 103 1450 103936000 2000
89703994 student_learner D Aug. 12, 2020, 3:39 p.m. OK Python 3 TESTS 103 1528 105369600 2000
88745927 shittttyyyyyy D Aug. 2, 2020, 4:07 p.m. OK Python 3 TESTS 103 1731 88883200 2000
88925987 janardhan_6635 D Aug. 5, 2020, 7:45 a.m. OK Python 3 TESTS 103 1762 40140800 2000
88926371 janardhan_6635 D Aug. 5, 2020, 7:51 a.m. OK Python 3 TESTS 103 1824 39526400 2000
88926447 janardhan_6635 D Aug. 5, 2020, 7:52 a.m. OK Python 3 TESTS 103 1825 39936000 2000
88926231 janardhan_6635 D Aug. 5, 2020, 7:49 a.m. OK Python 3 TESTS 103 1965 39526400 2000
88914510 Strorkis D Aug. 5, 2020, 4:19 a.m. OK Rust TESTS 103 93 17817600 2000
89563303 dataisland D Aug. 11, 2020, 8:58 a.m. OK Rust TESTS 103 187 15155200 2000
89636522 terraformer D Aug. 12, 2020, 8:59 a.m. OK Rust TESTS 103 280 34611200 2000

remove filters

Back to search problems