Codeforces Round 857 (Div. 1)

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
1801 Codeforces Round 857 (Div. 1) FINISHED False 10800 58911863 March 9, 2023, 9:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2344 ) D The way home PROGRAMMING dp graphs greedy shortest paths sortings

B"He's going to get there by plane. In total, there are m flights in the country, i -th flies from city a_i to city b_i and costs s_i coins. Note that the i -th flight is one-way, so it can't be used to get from city b_i to city a_i . To use it, Borya must be in the city a_i and have at least s_i coins (which he will spend on the flight). After the robbery, he has only p coins left, but he does not despair! Being in the city i , he can organize performances every day, each performance will bring him w_i coins. Help the magician find out if he will be able to get home, and what is the minimum number of performances he will have to organize. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 80 ) xe2 x80 x93 the number of test cases. The description of test cases follows. The first line contains three integers n , m and p ( 2 <= n <= 800 , 1 <= m <= 3000 , 0 <= p <= 10^9 ) -- the number of cities, the number of flights and the initial amount of coins. The second line contains n integers w_1, w_2, ldots, w_n (1 <= w_i <= 10^9) -- profit from representations. The following m lines each contain three integers a_i , b_i and s_i ( 1 <= a_i, b_i <= n , 1 <= s_i <= 10^9 ) -- the starting and ending city, and the cost of i -th flight. It is guaranteed that the sum of n over all test cases does not exceed 800 and the sum of m over all test cases does not exceed 10000 . For each test case print a single integer -- the minimum number of performances Borya will have to organize to get home, or -1 if it is impossible to do this. In the first example, it is optimal for Borya to make 4 performances in the first city, having as a result 2 + 7 cdot 4 = 30 coins, and then walk along the route 1-3-2"...

Tutorials

Codeforces Round #857 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
196631813 mban259 D March 9, 2023, 11:10 a.m. OK C# 10 TESTS 83 296 18329600
196637113 KumaTachiRen D March 9, 2023, 11:28 a.m. OK C# 8 TESTS 83 764 106496000
196616723 hos.lyric D March 9, 2023, 10:20 a.m. OK D TESTS 83 405 25600000
196635683 Soetdit D March 9, 2023, 11:23 a.m. OK GNU C++14 TESTS 83 46 13619200
196621326 Isonan D March 9, 2023, 10:35 a.m. OK GNU C++14 TESTS 83 62 7987200
196649088 Otomochi_Una D March 9, 2023, 12:07 p.m. OK GNU C++14 TESTS 83 78 10752000
196736807 AsiaticToddaliaRoot D March 10, 2023, 4:40 a.m. OK GNU C++14 TESTS 85 78 12185600
196649856 The_thought_of_fallout D March 9, 2023, 12:09 p.m. OK GNU C++14 TESTS 83 93 1740800
196619120 Tom66 D March 9, 2023, 10:28 a.m. OK GNU C++14 TESTS 83 93 10137600
196632090 HowToSolveA D March 9, 2023, 11:11 a.m. OK GNU C++14 TESTS 83 93 12083200
196657656 Doru D March 9, 2023, 12:32 p.m. OK GNU C++14 TESTS 83 93 12288000
196639433 CyanSineSin D March 9, 2023, 11:35 a.m. OK GNU C++14 TESTS 83 93 12288000
196728266 zrt0704 D March 10, 2023, 1:36 a.m. OK GNU C++14 TESTS 85 93 13004800
196671414 Fly_37 D March 9, 2023, 2:23 p.m. OK GNU C++17 TESTS 85 46 17100800
196654934 milisav D March 9, 2023, 12:25 p.m. OK GNU C++17 TESTS 83 62 5529600
196734978 Kieray D March 10, 2023, 4:08 a.m. OK GNU C++17 TESTS 85 78 8806400
196668454 leo020630 D March 9, 2023, 2:05 p.m. OK GNU C++17 TESTS 84 78 10854400
196658842 zas111lll D March 9, 2023, 12:34 p.m. OK GNU C++17 TESTS 83 93 13004800
196642398 mishanya_stulov D March 9, 2023, 11:45 a.m. OK GNU C++17 TESTS 83 93 13926400
196633975 Natsuzora D March 9, 2023, 11:17 a.m. OK GNU C++17 TESTS 83 108 11980800
196726773 Swishy123 D March 10, 2023, 12:57 a.m. OK GNU C++17 TESTS 85 108 12083200
196701294 Rakesh_32199 D March 9, 2023, 6:20 p.m. OK GNU C++17 TESTS 85 108 12800000
196631149 JOHNKRAM D March 9, 2023, 11:08 a.m. OK GNU C++17 TESTS 83 109 102400
196632625 DoorhandleMahoushoujo D March 9, 2023, 11:13 a.m. OK GNU C++17 (64) TESTS 83 31 307200
196627927 fuppy D March 9, 2023, 10:57 a.m. OK GNU C++17 (64) TESTS 83 46 11161600
196627747 ExplodingKonjac D March 9, 2023, 10:57 a.m. OK GNU C++17 (64) TESTS 83 62 11980800
196720114 enslaved D March 9, 2023, 10:07 p.m. OK GNU C++17 (64) TESTS 85 62 12595200
196619763 Licha06 D March 9, 2023, 10:30 a.m. OK GNU C++17 (64) TESTS 83 62 12800000
196655799 HCPS42 D March 9, 2023, 12:27 p.m. OK GNU C++17 (64) TESTS 83 77 8192000
196636993 minato D March 9, 2023, 11:27 a.m. OK GNU C++17 (64) TESTS 83 77 13004800
196625982 Lawali D March 9, 2023, 10:51 a.m. OK GNU C++17 (64) TESTS 83 78 204800
196648148 Dawnq D March 9, 2023, 12:04 p.m. OK GNU C++17 (64) TESTS 83 78 5427200
196628959 ALILILILILI-KHAN D March 9, 2023, 11:01 a.m. OK GNU C++17 (64) TESTS 83 78 12288000
196620435 Yelan D March 9, 2023, 10:32 a.m. OK GNU C++20 (64) TESTS 83 46 102400
196701039 yaufung D March 9, 2023, 6:18 p.m. OK GNU C++20 (64) TESTS 85 46 204800
196653842 yaufung D March 9, 2023, 12:21 p.m. OK GNU C++20 (64) TESTS 83 46 204800
196617463 Alice_foo_foo D March 9, 2023, 10:22 a.m. OK GNU C++20 (64) TESTS 83 46 10547200
196630196 InternetPerson10 D March 9, 2023, 11:05 a.m. OK GNU C++20 (64) TESTS 83 46 10752000
196655875 HollwoQ_Pelw D March 9, 2023, 12:27 p.m. OK GNU C++20 (64) TESTS 83 46 11673600
196668360 just3500code D March 9, 2023, 2:05 p.m. OK GNU C++20 (64) TESTS 84 46 11980800
196614757 maroonrk D March 9, 2023, 10:14 a.m. OK GNU C++20 (64) TESTS 83 46 11980800
196629299 Kizuna_AI D March 9, 2023, 11:02 a.m. OK GNU C++20 (64) TESTS 83 62 5324800
196629970 newbie_wrz D March 9, 2023, 11:04 a.m. OK GNU C++20 (64) TESTS 83 62 5427200
196619584 insert_cool_handle D March 9, 2023, 10:29 a.m. OK Java 11 TESTS 83 2979 0
196639688 iakovlev.zakhar D March 9, 2023, 11:36 a.m. OK Java 8 TESTS 83 218 0
196648832 fetetriste D March 9, 2023, 12:06 p.m. OK Java 8 TESTS 83 421 9523200
196622599 FastFreeTask D March 9, 2023, 10:40 a.m. OK Kotlin 1.6 TESTS 83 343 0
196643571 Hakiobo D March 9, 2023, 11:49 a.m. OK Kotlin 1.6 TESTS 83 451 18636800
196637288 tamato D March 9, 2023, 11:28 a.m. OK PyPy 3-64 TESTS 83 607 14233600
196651633 dabbler1 D March 9, 2023, 12:15 p.m. OK PyPy 3-64 TESTS 83 1387 50892800
196645782 zii.hrs D March 9, 2023, 11:56 a.m. OK PyPy 3-64 TESTS 83 1950 34099200
196682004 Little_Sheep_Yawn D March 9, 2023, 3:47 p.m. OK PyPy 3-64 TESTS 85 2651 43827200
196726866 Spheniscine D March 10, 2023, 1 a.m. OK Rust 2021 TESTS 85 93 26009600

remove filters

Back to search problems