Educational Codeforces Round 158 (Rated for 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
1901 Educational Codeforces Round 158 (Rated for Div. 2) FINISHED False 7200 30986699 Nov. 24, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 155 ) F Landscaping PROGRAMMING binary search geometry

B'You are appointed to a very important task: you are in charge of flattening one specific road. The road can be represented as a polygonal line starting at (0, 0) , ending at (n - 1, 0) and consisting of n vertices (including starting and ending points). The coordinates of the i -th vertex of the polyline are (i, a_i) . "Flattening" road is equivalent to choosing some line segment from (0, y_0) to (n - 1, y_1) such that all points of the polyline are below the chosen segment (or on the same height). Values y_0 and y_1 may be real. You can imagine that the road has some dips and pits, and you start pouring pavement onto it until you make the road flat. Points 0 and n - 1 have infinitely high walls, so pavement doesn 't fall out of segment [0, n - 1] . The cost of flattening the road is equal to the area between the chosen segment and the polyline. You want to minimize the cost, that 's why the flattened road is not necessary horizontal. But there is a problem: your data may be too old, so you sent a person to measure new heights. The person goes from 0 to n - 1 and sends you new heights b_i of each vertex i of the polyline. Since measuring new heights may take a while, and you don 't know when you 'll be asked, calculate the minimum cost (and corresponding y_0 and y_1 ) to flatten the road after each new height b_i you get. The first line contains a single integer n ( 3 <= n <= 2 cdot 10^5 ) -- the number of vertices of the polyline. The second line contains n integers a_0, a_1, ... , a_{n - 1} ( 0 <= a_i <= 10^9 ; a_0 = a_{n - 1} = 0 ) -- the heights of the corresponding vertices. The third line contains n integers b_0, b_1, ... , b_{n - 1} ( 0 <= b_i <= 10^9 ; b_0 = b_{n - 1} = 0 ) -- the new heights of the corresponding vertices. Print n numbers: as the i -th number ( 0 -'...

Tutorials

Educational Codeforces Round 158 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
234124228 Unk1ndled F Nov. 24, 2023, 5:06 p.m. OK GNU C11 TESTS 64 1497 4812800
234127801 DCC_Abir F Nov. 24, 2023, 5:28 p.m. OK GNU C++14 TESTS 64 1856 12185600
234125590 StarSilk F Nov. 24, 2023, 5:14 p.m. OK GNU C++14 TESTS 64 1902 12185600
234127254 StarSilk F Nov. 24, 2023, 5:25 p.m. OK GNU C++14 TESTS 64 1965 12185600
234119994 CJ-_zhuyifan F Nov. 24, 2023, 4:44 p.m. OK GNU C++17 TESTS 64 374 109260800
234122098 CJ-_zhuyifan F Nov. 24, 2023, 4:54 p.m. OK GNU C++17 TESTS 64 405 92467200
234160898 patou F Nov. 25, 2023, 12:50 a.m. OK GNU C++17 TESTS 65 576 17920000
234157918 patou F Nov. 24, 2023, 11:20 p.m. OK GNU C++17 TESTS 65 608 15769600
234165369 Liuxizai F Nov. 25, 2023, 2:26 a.m. OK GNU C++17 (64) TESTS 65 514 45670400
234174708 chappy1 F Nov. 25, 2023, 4:51 a.m. OK GNU C++17 (64) TESTS 65 795 76902400
234121908 jeroenodb F Nov. 24, 2023, 4:53 p.m. OK GNU C++20 (64) TESTS 64 358 12083200
234114294 jeroenodb F Nov. 24, 2023, 4:29 p.m. OK GNU C++20 (64) TESTS 64 452 15974400
234123589 CMR25_22r05a0407 F Nov. 24, 2023, 5:02 p.m. OK GNU C++20 (64) TESTS 64 452 15974400
234170093 A_G F Nov. 25, 2023, 3:48 a.m. OK GNU C++20 (64) TESTS 65 498 5939200
234139795 femboy-wannabe F Nov. 24, 2023, 6:59 p.m. OK GNU C++20 (64) TESTS 64 732 19251200
234132053 ImNotCandyOreO3O F Nov. 24, 2023, 5:59 p.m. OK GNU C++20 (64) TESTS 64 857 18124800
234112666 tute7627 F Nov. 24, 2023, 4:26 p.m. OK GNU C++20 (64) TESTS 64 873 31641600
234123307 zmy123456 F Nov. 24, 2023, 5:01 p.m. OK GNU C++20 (64) TESTS 64 904 24473600
234130555 ImNotCandyOreO3O F Nov. 24, 2023, 5:48 p.m. OK GNU C++20 (64) TESTS 64 1263 19660800
234168830 qiuzx F Nov. 25, 2023, 3:28 a.m. OK GNU C++20 (64) TESTS 65 1419 19046400

remove filters

Back to search problems