Codeforces Round 114 (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
167 Codeforces Round 114 (Div. 1) FINISHED False 7200 443545223 March 27, 2012, 3 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 217 ) D Wizards and Roads PROGRAMMING data structures divide and conquer graph matchings graphs greedy 2900

In some country live wizards. They love to build cities and roads. The country used to have k cities, the j -th city ( 1 ≤ j ≤ k ) was located at a point ( x j , y j ). It was decided to create another n - k cities. And the i -th one ( k < i ≤ n ) was created at a point with coordinates ( x i , y i ): x i = ( a · x i - 1 + b ) mod (10 9 + 9) y i = ( c · y i - 1 + d ) mod (10 9 + 9) Here a , b , c , d are primes. Also, a ≠ c , b ≠ d . After the construction of all n cities, the wizards have noticed something surprising. It turned out that for every two different cities i and j , x i ≠ x j and y i ≠ y j holds. The cities are built, it's time to build roads! It was decided to use the most difficult (and, of course, the most powerful) spell for the construction of roads. Using this spell creates a road between the towns of u , v ( y u > y v ) if and only if for any city w which lies strictly inside the corner at the point u , v (see below), there is a city s that does not lie in the corner, which is located along the x -coordinate strictly between w and u and simultaneously y s > y v . A corner on the points p 2 ( x 2 , y 2 ), p 1 ( x 1 , y 1 ) ( y 1 < y 2 ) is the set of points ( x , y ), for which at least one of the two conditions is fulfilled: min ( x 1 , x 2 ) ≤ x ≤ max ( x 1 , x 2 ) and y ≥ y 1 y 1 ≤ y ≤ y 2 and ( x - x 2 )·( x 1 - x 2 ) ≥ 0 In order to test the spell, the wizards will apply it to all the cities that lie on the x -coordinate in the interval L , R . After the construction of roads the national government wants to choose the maximum number of pairs of cities connected by the road, so that no city occurs in two or more pairs. Your task is for each m offered variants of values L , R to calculate the maximum number of such pairs after the construction of the roads. Please note that the cities that do not lie in the interval L , R on the x -coordinate, do not affect the construction of roads in any way. The first line contains two spac

Tutorials

Codeforces Round #114 — Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
1699219 blackapple D May 17, 2012, 1:03 p.m. OK FPC TESTS 70 670 7577600 2900
2828830 Seasons D Dec. 26, 2012, 12:13 p.m. OK GNU C++ TESTS 70 203 3584000 2900
2868909 yxfish D Jan. 3, 2013, 10:03 a.m. OK GNU C++ TESTS 70 250 20070400 2900
2865215 xlk D Jan. 2, 2013, 4:29 a.m. OK GNU C++ TESTS 70 265 3584000 2900
2903160 shmily552255 D Jan. 10, 2013, 5:47 p.m. OK GNU C++ TESTS 70 265 3993600 2900
2555398 ACMonster D Nov. 14, 2012, 6:14 a.m. OK GNU C++ TESTS 70 265 12185600 2900
14172908 130705009 D Nov. 9, 2015, 3:07 p.m. OK GNU C++ TESTS 70 278 3584000 2900
5620702 PSDEV D Jan. 5, 2014, 8:41 a.m. OK GNU C++ TESTS 70 280 3584000 2900
4271649 vjudge3 D Aug. 13, 2013, 3:55 a.m. OK GNU C++ TESTS 70 280 3584000 2900
4271639 vjudge5 D Aug. 13, 2013, 3:51 a.m. OK GNU C++ TESTS 70 280 3584000 2900
4271561 vjudge1 D Aug. 13, 2013, 3:16 a.m. OK GNU C++ TESTS 70 280 3584000 2900
2860926 CMHJT D Dec. 31, 2012, 11:49 a.m. OK GNU C++0x TESTS 70 265 3584000 2900
9936172 Pudge123 D Feb. 20, 2015, 10:36 a.m. OK GNU C++0x TESTS 70 280 7270400 2900
2879921 sayade D Jan. 7, 2013, 7:34 a.m. OK GNU C++0x TESTS 70 281 3174400 2900
2828185 dc. D Dec. 26, 2012, 8:27 a.m. OK GNU C++0x TESTS 70 343 5017600 2900
2863397 bakabakashyoshyo D Jan. 1, 2013, 11:59 a.m. OK GNU C++0x TESTS 70 375 65331200 2900
2665809 moreD D Nov. 27, 2012, 2:04 a.m. OK GNU C++0x TESTS 70 484 40857600 2900
2771805 roosephu D Dec. 16, 2012, 6:01 a.m. OK GNU C++0x TESTS 70 890 3481600 2900
50280616 XuYipei D Feb. 21, 2019, 12:32 p.m. OK GNU C++11 TESTS 70 278 6451200 2900
61188767 Xi_Jinping D Sept. 24, 2019, 1:16 a.m. OK GNU C++11 TESTS 70 280 3584000 2900
61099684 Xi_Jinping D Sept. 23, 2019, 6:01 a.m. OK GNU C++11 TESTS 70 280 3584000 2900
57901951 lopare D July 28, 2019, 4:02 p.m. OK GNU C++11 TESTS 70 280 3584000 2900
57822817 py_ultron D July 27, 2019, 12:54 a.m. OK GNU C++11 TESTS 70 280 3584000 2900
49525144 nekko D Feb. 6, 2019, 10:53 a.m. OK GNU C++11 TESTS 70 280 28876800 2900
44840421 cuizhuyefei D Oct. 25, 2018, 12:34 p.m. OK GNU C++11 TESTS 70 310 15155200 2900
25677895 shuaige123 D March 20, 2017, 11:08 p.m. OK GNU C++11 TESTS 70 312 6963200 2900
25677867 shuaige123 D March 20, 2017, 11:04 p.m. OK GNU C++11 TESTS 70 312 6963200 2900
35783534 JeremyGuo D Feb. 28, 2018, 12:09 p.m. OK GNU C++11 TESTS 70 342 5324800 2900
23670378 Ali.Pi D Jan. 9, 2017, 8:05 p.m. OK GNU C++14 TESTS 70 280 5529600 2900
56862936 cloudsky01 D July 12, 2019, 12:53 a.m. OK GNU C++14 TESTS 70 310 3584000 2900
57184359 sorry_im_smurfing D July 17, 2019, 8:14 a.m. OK GNU C++14 TESTS 70 312 3584000 2900
44838607 VPigeonKing D Oct. 25, 2018, 11:57 a.m. OK GNU C++14 TESTS 70 560 3174400 2900
55984292 Scut82 D June 24, 2019, 1:36 a.m. OK GNU C++14 TESTS 70 590 17612800 2900
28193434 Emiso D July 1, 2017, 2:34 p.m. OK GNU C++14 TESTS 70 748 7782400 2900
62057099 vjudge4 D Oct. 7, 2019, 12:27 p.m. OK GNU C++14 TESTS 70 902 7475200 2900
50692224 ZNI D March 2, 2019, 4:14 p.m. OK GNU C++14 TESTS 70 1028 15667200 2900
48413036 hychyc D Jan. 15, 2019, 8:51 a.m. OK GNU C++14 TESTS 70 1402 2764800 2900
43814564 ruo D Oct. 5, 2018, 4:10 a.m. OK GNU C++17 TESTS 70 342 3584000 2900
60917656 Danylo99 D Sept. 20, 2019, 9:04 a.m. OK GNU C++17 TESTS 70 1214 3174400 2900
1440760 Di735 D March 29, 2012, 4:31 p.m. OK Java 7 TESTS 70 670 44953600 2900
1624924 Madiyar D April 24, 2012, 6:10 p.m. OK Java 7 TESTS 70 970 45056000 2900
1442240 Di735 D March 30, 2012, 4:10 a.m. OK Java 7 TESTS 70 1260 45158400 2900
1496686 NALP D April 7, 2012, 7:51 p.m. OK MS C++ TESTS 70 830 7065600 2900
1429964 al13n D March 27, 2012, 4:27 p.m. OK MS C++ TESTS 70 920 26316800 2900
1441837 ballon D March 29, 2012, 10:01 p.m. OK MS C++ TESTS 70 940 8601600 2900
1441832 ballon D March 29, 2012, 10 p.m. OK MS C++ TESTS 70 980 8601600 2900
1441714 ballon D March 29, 2012, 8:47 p.m. OK MS C++ TESTS 70 1010 8601600 2900

remove filters

Back to search problems