Codeforces Round 295 (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
520 Codeforces Round 295 (Div. 2) FINISHED False 7500 351126023 March 2, 2015, 7 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1667 ) D Cubes PROGRAMMING games greedy implementation 2400

Once Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the ground, and the OY is directed upwards. Each cube is associated with the coordinates of its lower left corner, these coordinates are integers for each cube. The figure turned out to be stable . This means that for any cube that is not on the ground, there is at least one cube under it such that those two cubes touch by a side or a corner . More formally, this means that for the cube with coordinates ( x , y ) either y = 0 , or there is a cube with coordinates ( x - 1, y - 1) , ( x , y - 1) or ( x + 1, y - 1) . Now the boys want to disassemble the figure and put all the cubes in a row. In one step the cube is removed from the figure and being put to the right of the blocks that have already been laid. The guys remove the cubes in such order that the figure remains stable. To make the process more interesting, the guys decided to play the following game. The guys take out the cubes from the figure in turns. It is easy to see that after the figure is disassembled, the integers written on the cubes form a number, written in the m -ary positional numerical system (possibly, with a leading zero). Vasya wants the resulting number to be maximum possible, and Petya, on the contrary, tries to make it as small as possible. Vasya starts the game. Your task is to determine what number is formed after the figure is disassembled, if the boys play optimally. Determine the remainder of the answer modulo 10 9 + 9 . The first line contains number m ( 2 ≤ m ≤ 10 5 ). The following m lines contain the coordinates of the cubes x i , y i ( - 10 9 ≤ x i ≤ 10 9 , 0 ≤ y i ≤ 10 9 ) in ascending order of numbers written on them. It is guaranteed that the original figure is stable. No two cubes occupy the same place. In the only line print the answer to the problem.

Tutorials

Codeforces Round #295 Editorial (now with bonuses!)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
40986946 ReaLNero1 D July 30, 2018, 8:51 p.m. OK GNU C++ TESTS 45 108 10956800 2400
38810119 bojverdict1 D May 31, 2018, 5:48 p.m. OK GNU C++ TESTS 45 140 14950400 2400
37563413 xfyydr1 D April 24, 2018, 4:07 a.m. OK GNU C++ TESTS 45 249 15564800 2400
42257700 Scut82 D Aug. 29, 2018, 11:42 p.m. OK GNU C++ TESTS 45 280 23244800 2400
38817373 bojverdict1 D June 1, 2018, 3:45 a.m. OK GNU C++ TESTS 45 296 10547200 2400
38803130 bojverdict2 D May 31, 2018, 1:15 p.m. OK GNU C++ TESTS 45 779 32870400 2400
38802583 bojverdict1 D May 31, 2018, 12:55 p.m. OK GNU C++ TESTS 45 826 64819200 2400
51283577 bojverdict1 D March 14, 2019, 5:54 a.m. OK GNU C++11 TESTS 45 139 13107200 2400
41328045 Ithea_Myse_Valgulious D Aug. 8, 2018, 6:58 a.m. OK GNU C++11 TESTS 45 265 23040000 2400
57886409 lopare D July 28, 2019, 10:07 a.m. OK GNU C++11 TESTS 45 280 22835200 2400
41327862 vjudge5 D Aug. 8, 2018, 6:52 a.m. OK GNU C++11 TESTS 45 280 22937600 2400
46206961 YaoBIG D Nov. 25, 2018, 2:54 p.m. OK GNU C++11 TESTS 45 295 25804800 2400
57818108 py_ultron D July 26, 2019, 8:57 p.m. OK GNU C++11 TESTS 45 296 22835200 2400
48210366 oihyxc D Jan. 11, 2019, 11:38 a.m. OK GNU C++11 TESTS 45 342 40448000 2400
38809689 bojverdict1 D May 31, 2018, 5:29 p.m. OK GNU C++11 TESTS 45 420 12697600 2400
56182031 joaom D June 28, 2019, 12:55 a.m. OK GNU C++11 TESTS 45 436 9216000 2400
38803714 bojverdict1 D May 31, 2018, 1:36 p.m. OK GNU C++11 TESTS 45 498 15257600 2400
41152523 alechuang98 D Aug. 3, 2018, 9:44 a.m. OK GNU C++14 TESTS 45 186 27136000 2400
38411764 brimix__ D May 18, 2018, 10:20 p.m. OK GNU C++14 TESTS 45 234 22630400 2400
39755492 kobortor D June 29, 2018, 1:05 a.m. OK GNU C++14 TESTS 45 264 14438400 2400
39755139 kobortor D June 29, 2018, 12:24 a.m. OK GNU C++14 TESTS 45 311 8294400 2400
49472266 Emiso D Feb. 4, 2019, 5:40 p.m. OK GNU C++14 TESTS 45 311 8601600 2400
44379696 margy D Oct. 16, 2018, 2:23 a.m. OK GNU C++14 TESTS 45 311 25088000 2400
40232026 lijiqi D July 12, 2018, 12:38 p.m. OK GNU C++14 TESTS 45 405 7987200 2400
50299935 MatheusOP D Feb. 22, 2019, 1:12 a.m. OK GNU C++14 TESTS 45 451 10547200 2400
68371153 hemant1729 D Jan. 7, 2020, 5:46 p.m. OK GNU C++14 TESTS 45 452 12492800 2400
41396879 E869120 D Aug. 9, 2018, 11:37 a.m. OK GNU C++14 TESTS 45 467 9625600 2400
38810058 XiaoWu D May 31, 2018, 5:46 p.m. OK GNU C++17 TESTS 45 202 16588800 2400
49396365 easter.prince D Feb. 3, 2019, 12:32 p.m. OK GNU C++17 TESTS 45 217 13926400 2400
47548184 vjudge5 D Dec. 27, 2018, 11:30 a.m. OK GNU C++17 TESTS 45 233 12800000 2400
47548171 vjudge4 D Dec. 27, 2018, 11:30 a.m. OK GNU C++17 TESTS 45 233 12800000 2400
47548125 zyb111 D Dec. 27, 2018, 11:28 a.m. OK GNU C++17 TESTS 45 249 12800000 2400
60142800 Phortox D Sept. 5, 2019, 9:13 p.m. OK GNU C++17 TESTS 45 249 30208000 2400
65327366 U_U D Nov. 19, 2019, 2:55 a.m. OK GNU C++17 TESTS 45 265 15052800 2400
60142291 Phortox D Sept. 5, 2019, 8:56 p.m. OK GNU C++17 TESTS 45 295 28467200 2400
61756285 ST_C D Oct. 3, 2019, 5:38 a.m. OK GNU C++17 TESTS 45 358 15462400 2400
68113001 OrangeRain D Jan. 3, 2020, 10:19 a.m. OK GNU C++17 TESTS 45 374 16486400 2400
56042991 AryssonFigueiredo D June 25, 2019, 3:12 p.m. OK Java 8 TESTS 45 733 10547200 2400

remove filters

Back to search problems