Codeforces Round 507 (Div. 1, based on Olympiad of Metropolises)

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
1039 Codeforces Round 507 (Div. 1, based on Olympiad of Metropolises) FINISHED False 7200 195657899 Sept. 5, 2018, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 788 ) A Timetable PROGRAMMING constructive algorithms data structures greedy math 2400

B"There are two bus stops denoted A and B, and there n buses that go from A to B every day. The shortest path from A to B takes t units of time but some buses might take longer paths. Moreover, buses are allowed to overtake each other during the route. At each station one can find a sorted list of moments of time when a bus is at this station. We denote this list as a_1 < a_2 < ldots < a_n for stop A and as b_1 < b_2 < ldots < b_n for stop B. The buses always depart from A and arrive to B according to the timetable, but the order in which the buses arrive may differ. Let's call an order of arrivals valid if each bus arrives at least t units of time later than departs. It is known that for an order to be valid the latest possible arrival for the bus that departs at a_i is b_{x_i} , i.e. x_i -th in the timetable. In other words, for each i there exists such a valid order of arrivals that the bus departed i -th arrives x_i -th (and all other buses can arrive arbitrary), but there is no valid order of arrivals in which the i -th departed bus arrives (x_i + 1) -th. Formally, let's call a permutation p_1, p_2, ldots, p_n valid, if b_{p_i} ge a_i + t for all i . Then x_i is the maximum value of p_i among all valid permutations. You are given the sequences a_1, a_2, ldots, a_n and x_1, x_2, ldots, x_n , but not the arrival timetable. Find out any suitable timetable for stop B b_1, b_2, ldots, b_n or determine that there is no such timetable. The first line of the input contains two integers n and t ( 1 <= q n <= q 200 ,000 , 1 <= q t <= q 10^{18} ) -- the number of buses in timetable for and the minimum possible travel time from stop A to stop B. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_1 < a_2 < ldots < a_n <= q 10^{18} ), defining the moments of time when the buses leave sto"...

Tutorials

61668

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
44751661 ReaLNero1 A Oct. 23, 2018, 8:17 p.m. OK GNU C++11 TESTS 40 109 5529600 2400
46756592 mtmohim A Dec. 8, 2018, 12:03 p.m. OK GNU C++11 TESTS 40 109 8089600 2400
43019027 luogu_bot2 A Sept. 18, 2018, 2:44 a.m. OK GNU C++11 TESTS 40 124 5529600 2400
43018879 Enzyme125 A Sept. 18, 2018, 2:34 a.m. OK GNU C++11 TESTS 40 124 5529600 2400
43592264 Jin_Haonan A Sept. 30, 2018, 3:44 a.m. OK GNU C++11 TESTS 40 139 4812800 2400
42603327 Shedneryan A Sept. 7, 2018, 6:19 a.m. OK GNU C++11 TESTS 40 139 5120000 2400
46954209 Heaplax A Dec. 13, 2018, 1:23 a.m. OK GNU C++11 TESTS 40 139 9625600 2400
42659171 LittleFall A Sept. 8, 2018, 2:26 a.m. OK GNU C++11 TESTS 40 140 3993600 2400
42658478 LittleFall A Sept. 8, 2018, 1:44 a.m. OK GNU C++11 TESTS 40 140 3993600 2400
42658404 LittleFall A Sept. 8, 2018, 1:37 a.m. OK GNU C++11 TESTS 40 140 3993600 2400
43712437 neal A Oct. 3, 2018, 4:56 a.m. OK GNU C++14 TESTS 40 140 9830400 2400
43712423 neal A Oct. 3, 2018, 4:55 a.m. OK GNU C++14 TESTS 40 186 9830400 2400
43435496 polequoll A Sept. 26, 2018, 5:14 a.m. OK GNU C++14 TESTS 40 202 10854400 2400
51482594 mayaohua2003 A March 19, 2019, 12:15 p.m. OK GNU C++14 TESTS 40 218 3993600 2400
42526227 Taube A Sept. 5, 2018, 6:32 p.m. OK GNU C++14 TESTS 40 218 5632000 2400
52060235 RNS_MHB A March 30, 2019, 11:48 p.m. OK GNU C++14 TESTS 40 218 7270400 2400
47516274 hychyc A Dec. 26, 2018, 10:09 a.m. OK GNU C++14 TESTS 40 233 3993600 2400
53054931 SayGB A April 20, 2019, 4:45 p.m. OK GNU C++14 TESTS 40 233 4812800 2400
53054133 SayGB A April 20, 2019, 4:16 p.m. OK GNU C++14 TESTS 40 233 4812800 2400
52352751 vjudge3 A April 5, 2019, 3:18 p.m. OK GNU C++14 TESTS 40 233 4812800 2400
42752688 DZYO A Sept. 11, 2018, 3:57 a.m. OK GNU C++17 TESTS 40 155 5324800 2400
42523076 Jaihk662 A Sept. 5, 2018, 6:19 p.m. OK GNU C++17 TESTS 40 218 5120000 2400
46969734 luogu_bot2 A Dec. 13, 2018, 1:12 p.m. OK GNU C++17 TESTS 40 233 3174400 2400
42517345 zoomswk A Sept. 5, 2018, 5:49 p.m. OK GNU C++17 TESTS 40 234 4300800 2400
42522347 natsugiri A Sept. 5, 2018, 6:15 p.m. OK GNU C++17 TESTS 40 234 5120000 2400
46060962 chinmay0906 A Nov. 22, 2018, 1:19 p.m. OK GNU C++17 TESTS 40 248 28262400 2400
68632385 user202729_ A Jan. 12, 2020, 3:45 a.m. OK GNU C++17 TESTS 40 249 3379200 2400
61598301 sigma425 A Oct. 1, 2019, 9:48 a.m. OK GNU C++17 TESTS 40 249 4096000 2400
44232831 nikutto A Oct. 13, 2018, 2 a.m. OK GNU C++17 TESTS 40 249 4300800 2400
63266116 Phortox A Oct. 24, 2019, 12:16 a.m. OK GNU C++17 TESTS 40 249 4812800 2400
42793267 SrapZark A Sept. 12, 2018, 10:02 a.m. OK Java 8 TESTS 40 233 0 2400
42508658 uwi A Sept. 5, 2018, 5:11 p.m. OK Java 8 TESTS 40 249 0 2400
42506599 mmaxio A Sept. 5, 2018, 5:02 p.m. OK Java 8 TESTS 40 249 0 2400
44418960 beroul A Oct. 16, 2018, 8:46 p.m. OK Java 8 TESTS 40 249 5324800 2400
42788277 SrapZark A Sept. 12, 2018, 6:25 a.m. OK Java 8 TESTS 40 265 0 2400
42503015 Egor A Sept. 5, 2018, 4:49 p.m. OK Java 8 TESTS 40 280 0 2400
42552254 Jeel_Vaishnav A Sept. 6, 2018, 12:40 p.m. OK Java 8 TESTS 40 296 3686400 2400
65566280 ijxjdjd A Nov. 23, 2019, 6:01 a.m. OK Java 8 TESTS 40 327 15667200 2400
42553724 fnch A Sept. 6, 2018, 1:17 p.m. OK Java 8 TESTS 40 374 15872000 2400
43011012 fetetriste A Sept. 17, 2018, 6:35 p.m. OK Java 8 TESTS 40 374 16384000 2400
42511826 leign A Sept. 5, 2018, 5:24 p.m. OK Mono C# TESTS 40 374 65331200 2400
42516728 math957963 A Sept. 5, 2018, 5:46 p.m. OK MS C++ TESTS 40 249 8601600 2400
42520453 LoneFox A Sept. 5, 2018, 6:05 p.m. OK MS C++ TESTS 40 421 7270400 2400
42525443 pajenegod A Sept. 5, 2018, 6:29 p.m. OK PyPy 2 TESTS 40 545 56832000 2400
42518173 zacker-22 A Sept. 5, 2018, 5:53 p.m. OK PyPy 2 TESTS 40 577 51609600 2400
42603901 Djok216 A Sept. 7, 2018, 6:39 a.m. OK Python 2 TESTS 40 1013 32358400 2400
42534272 nns2009 A Sept. 5, 2018, 11:34 p.m. OK Python 3 TESTS 40 1123 20172800 2400
42534010 nns2009 A Sept. 5, 2018, 11:13 p.m. OK Python 3 TESTS 40 1169 20275200 2400
42625685 lightG A Sept. 7, 2018, 3:06 p.m. OK Python 3 TESTS 40 1278 20582400 2400

remove filters

Back to search problems