Codeforces Round 870 (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
1826 Codeforces Round 870 (Div. 2) FINISHED False 7200 53969063 May 5, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10652 ) D Running Miles PROGRAMMING brute force dp greedy 1700

B"There is a street with n sights, with sight number i being i miles from the beginning of the street. Sight number i has beauty b_i . You want to start your morning jog l miles and end it r miles from the beginning of the street. By the time you run, you will see sights you run by (including sights at l and r miles from the start). You are interested in the 3 most beautiful sights along your jog, but every mile you run, you get more and more tired. So choose l and r , such that there are at least 3 sights you run by, and the sum of beauties of the 3 most beautiful sights minus the distance in miles you have to run is maximized. More formally, choose l and r , such that b_{i_1} + b_{i_2} + b_{i_3} - (r - l) is maximum possible, where i_1, i_2, i_3 are the indices of the three maximum elements in range [l, r] . The first line contains a single integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The first line of each test case contains a single integer n ( 3 <= q n <= q 10^5 ). The second line of each test case contains n integers b_i ( 1 <= q b_i <= q 10^8 ) -- beauties of sights i miles from the beginning of the street. It's guaranteed that the sum of all n does not exceed 10^5 . For each test case output a single integer equal to the maximum value b_{i_1} + b_{i_2} + b_{i_3} - (r - l) for some running range [l, r] . In the first example, we can choose l and r to be 1 and 5 . So we visit all the sights and the three sights with the maximum beauty are the sights with indices 1 , 3 , and 5 with beauties 5 , 4 , and 3 , respectively. So the total value is 5 + 4 + 3 - (5 - 1) = 8 . In the second example, the range [l, r] can be [1, 3] or [2, 4] , the total value is 1 + 1 + 1 - (3 - 1) = 1 . "...

Tutorials

Codeforces Round #870 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
205030650 FatalityNT D May 7, 2023, 11:10 p.m. OK C# 8 TESTS 42 170 9113600 1700
205145895 bkifhr7 D May 8, 2023, 4:51 p.m. OK Clang++17 Diagnostics TESTS 42 889 1945600 1700
205315764 alpeevandrey D May 10, 2023, 10:43 a.m. OK Clang++20 Diagnostics TESTS 42 77 921600 1700
205665972 thunopro D May 13, 2023, 3:58 a.m. OK Clang++20 Diagnostics TESTS 42 654 2355200 1700
206013733 ruban D May 15, 2023, 5:21 p.m. OK FPC TESTS 42 108 118272000 1700
205074947 CaveNightingale D May 8, 2023, 11:34 a.m. OK GNU C11 TESTS 42 31 2355200 1700
204969366 jstzmxuan D May 7, 2023, 12:07 p.m. OK GNU C++14 TESTS 42 15 3276800 1700
205247858 tutturushi D May 9, 2023, 4:01 p.m. OK GNU C++14 TESTS 42 31 1228800 1700
205338683 Esna D May 10, 2023, 2:22 p.m. OK GNU C++14 TESTS 42 31 1228800 1700
205089887 Halex_415 D May 8, 2023, 12:24 p.m. OK GNU C++14 TESTS 42 31 1228800 1700
206354830 meghanakotha2004 D May 18, 2023, 2:51 p.m. OK GNU C++14 TESTS 42 31 1228800 1700
205305724 Const_int D May 10, 2023, 8:44 a.m. OK GNU C++14 TESTS 42 31 1638400 1700
204969699 jstzmxuan D May 7, 2023, 12:10 p.m. OK GNU C++14 TESTS 42 31 3276800 1700
205430164 c1120231020 D May 11, 2023, 12:43 p.m. OK GNU C++14 TESTS 42 31 3276800 1700
205392254 ekac D May 11, 2023, 5:52 a.m. OK GNU C++14 TESTS 42 31 16076800 1700
205922805 okm30 D May 14, 2023, 8:54 p.m. OK GNU C++14 TESTS 42 46 0 1700
204968042 great_fortune D May 7, 2023, 11:55 a.m. OK GNU C++17 TESTS 42 31 819200 1700
205035250 Seungni D May 8, 2023, 1:47 a.m. OK GNU C++17 TESTS 42 31 1228800 1700
205371348 Harshu04 D May 10, 2023, 9:06 p.m. OK GNU C++17 TESTS 42 31 1228800 1700
205395211 Syf2020 D May 11, 2023, 6:33 a.m. OK GNU C++17 TESTS 42 31 2048000 1700
204958624 code_struck D May 7, 2023, 10:29 a.m. OK GNU C++17 TESTS 42 46 0 1700
206060564 BIG-HSY D May 16, 2023, 8:04 a.m. OK GNU C++17 TESTS 42 46 0 1700
205773802 PurpleCrayon D May 14, 2023, 12:41 a.m. OK GNU C++17 TESTS 42 46 409600 1700
206418820 S_T_A_R_K D May 19, 2023, 8 a.m. OK GNU C++17 TESTS 42 46 819200 1700
206177117 1eave D May 17, 2023, 6:48 a.m. OK GNU C++17 TESTS 42 46 819200 1700
205824052 rohith D May 14, 2023, 11:05 a.m. OK GNU C++17 TESTS 42 46 819200 1700
205184352 y_combinator D May 9, 2023, 5 a.m. OK GNU C++17 (64) TESTS 42 31 819200 1700
204918244 GoogleBot D May 7, 2023, 4:21 a.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
206176163 Lenlynn D May 17, 2023, 6:37 a.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205627256 Lycoris D May 12, 2023, 5:30 p.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205368328 noomaK D May 10, 2023, 8:14 p.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205224535 sanbi52 D May 9, 2023, 12:39 p.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205179439 RF_Faisal D May 9, 2023, 3:15 a.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205046168 rishit3234 D May 8, 2023, 5:51 a.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205014499 nksrivastava18 D May 7, 2023, 6:15 p.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
204971793 Quang D May 7, 2023, 12:28 p.m. OK GNU C++17 (64) TESTS 42 31 1228800 1700
205059491 vladburac D May 8, 2023, 8:42 a.m. OK GNU C++20 (64) TESTS 42 31 0 1700
206154845 Sputnik1234 D May 16, 2023, 8:42 p.m. OK GNU C++20 (64) TESTS 42 31 0 1700
206332891 LiMit3 D May 18, 2023, 11:32 a.m. OK GNU C++20 (64) TESTS 42 31 0 1700
204916249 Ormlis D May 7, 2023, 3:45 a.m. OK GNU C++20 (64) TESTS 42 31 0 1700
206154720 Sputnik1234 D May 16, 2023, 8:40 p.m. OK GNU C++20 (64) TESTS 42 31 0 1700
205154152 jiangly D May 8, 2023, 6:16 p.m. OK GNU C++20 (64) TESTS 42 31 409600 1700
205733665 YouStill_DontKnowMeYet D May 13, 2023, 3:07 p.m. OK GNU C++20 (64) TESTS 42 31 409600 1700
205292938 zhangtianhan D May 10, 2023, 6:04 a.m. OK GNU C++20 (64) TESTS 42 31 409600 1700
205058640 YYYLLL2021 D May 8, 2023, 8:32 a.m. OK GNU C++20 (64) TESTS 42 31 716800 1700
206398195 MeetAmin D May 19, 2023, 2:56 a.m. OK GNU C++20 (64) TESTS 42 31 819200 1700
205740052 Kimi_Zhang D May 13, 2023, 4:09 p.m. OK Go TESTS 42 93 13824000 1700
204986235 themadknight45 D May 7, 2023, 2:36 p.m. OK Java 11 TESTS 42 248 0 1700
206372150 The_terminator D May 18, 2023, 5:42 p.m. OK Java 11 TESTS 42 374 0 1700
206376203 js2585 D May 18, 2023, 6:23 p.m. OK Java 11 TESTS 42 374 0 1700
204955979 Daly105 D May 7, 2023, 10:02 a.m. OK Java 11 TESTS 42 436 8192000 1700
204935717 wintersoldier2004 D May 7, 2023, 7:01 a.m. OK Java 17 TESTS 42 467 1126400 1700
204942102 wintersoldier2004 D May 7, 2023, 8:05 a.m. OK Java 17 TESTS 42 468 921600 1700
204969713 dev1l_1 D May 7, 2023, 12:10 p.m. OK Java 17 TESTS 42 514 819200 1700
205124360 sachinjaiswal D May 8, 2023, 2:08 p.m. OK Java 8 TESTS 42 156 0 1700
206291619 ZXF_521mua D May 18, 2023, 2:49 a.m. OK Java 8 TESTS 42 248 0 1700
205993536 PP_2023 D May 15, 2023, 2:02 p.m. OK Java 8 TESTS 42 467 0 1700
205507343 vjudge4 D May 12, 2023, 7:04 a.m. OK Java 8 TESTS 42 467 0 1700
205797677 luogu_bot3 D May 14, 2023, 7:17 a.m. OK Java 8 TESTS 42 483 0 1700
205447140 luogu_bot4 D May 11, 2023, 3:08 p.m. OK Java 8 TESTS 42 483 0 1700
205447136 bkifhr8 D May 11, 2023, 3:08 p.m. OK Java 8 TESTS 42 483 0 1700
205797683 bkifhr6 D May 14, 2023, 7:17 a.m. OK Java 8 TESTS 42 498 0 1700
205507334 vjudge1 D May 12, 2023, 7:04 a.m. OK Java 8 TESTS 42 514 0 1700
205896597 bkifhr7 D May 14, 2023, 4:18 p.m. OK Java 8 TESTS 42 514 0 1700
205658655 PZP D May 13, 2023, 1:46 a.m. OK MS C++ 2017 TESTS 42 62 4812800 1700
205976153 Zhang.QZ D May 15, 2023, 11:50 a.m. OK MS C++ 2017 TESTS 42 249 2457600 1700
205296142 JUBHAI D May 10, 2023, 6:45 a.m. OK PyPy 3 TESTS 42 327 10547200 1700
206318556 soudhamini_2000031088 D May 18, 2023, 9:13 a.m. OK PyPy 3 TESTS 42 826 10547200 1700
205360575 KeiTsukishima D May 10, 2023, 6:18 p.m. OK PyPy 3 TESTS 42 857 74035200 1700
205181578 julondonor D May 9, 2023, 4:02 a.m. OK PyPy 3 TESTS 42 873 12288000 1700
205640316 ipip D May 12, 2023, 7:24 p.m. OK PyPy 3 TESTS 42 889 10752000 1700
205295903 JUBHAI D May 10, 2023, 6:43 a.m. OK PyPy 3 TESTS 42 982 12185600 1700
205348554 R002 D May 10, 2023, 4 p.m. OK PyPy 3 TESTS 42 1013 14028800 1700
204928010 Shiroi_Brevity D May 7, 2023, 5:50 a.m. OK PyPy 3 TESTS 42 1060 13004800 1700
204966352 drugkeeper D May 7, 2023, 11:41 a.m. OK PyPy 3-64 TESTS 42 140 20070400 1700
205370419 hash1023 D May 10, 2023, 8:48 p.m. OK PyPy 3-64 TESTS 42 155 24473600 1700
205721120 Turtleeee D May 13, 2023, 1:03 p.m. OK PyPy 3-64 TESTS 42 156 14233600 1700
206325704 AyuAnchor D May 18, 2023, 10:26 a.m. OK PyPy 3-64 TESTS 42 170 14028800 1700
205007716 IllegalRazer D May 7, 2023, 5:04 p.m. OK PyPy 3-64 TESTS 42 171 18124800 1700
206218828 FridayThe13th D May 17, 2023, 1:50 p.m. OK PyPy 3-64 TESTS 42 171 20889600 1700
206392467 bkifhr8 D May 19, 2023, 12:04 a.m. OK PyPy 3-64 TESTS 42 186 20070400 1700
205370921 hash1023 D May 10, 2023, 8:58 p.m. OK PyPy 3-64 TESTS 42 186 20172800 1700
205296399 JUBHAI D May 10, 2023, 6:48 a.m. OK PyPy 3-64 TESTS 42 187 15155200 1700
205371117 hash1023 D May 10, 2023, 9:02 p.m. OK PyPy 3-64 TESTS 42 187 19660800 1700
205629902 Pavan125 D May 12, 2023, 5:51 p.m. OK Python 3 TESTS 42 467 13721600 1700
205502314 2000030045 D May 12, 2023, 6:01 a.m. OK Python 3 TESTS 42 467 13721600 1700
205691676 2000032077cse D May 13, 2023, 8:26 a.m. OK Python 3 TESTS 42 483 13721600 1700
206019462 sridharsiddi D May 15, 2023, 6:25 p.m. OK Python 3 TESTS 42 498 13721600 1700
205406622 Deepak_Sujay D May 11, 2023, 8:51 a.m. OK Python 3 TESTS 42 530 37171200 1700
205162588 kost D May 8, 2023, 8:10 p.m. OK Rust 2021 TESTS 42 31 9113600 1700
205060480 cottoncotton D May 8, 2023, 8:54 a.m. OK Rust 2021 TESTS 42 31 69324800 1700

remove filters

Back to search problems