Codeforces Round #Pi (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
567 Codeforces Round #Pi (Div. 2) FINISHED False 9000 337615223 Aug. 5, 2015, 4 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5234 ) D One-Dimensional Battle Ships PROGRAMMING binary search data structures greedy sortings 1800

Alice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n square cells (that is, on a 1 × n table). At the beginning of the game Alice puts k ships on the field without telling their positions to Bob. Each ship looks as a 1 × a rectangle (that is, it occupies a sequence of a consecutive squares of the field). The ships cannot intersect and even touch each other. After that Bob makes a sequence of "shots". He names cells of the field and Alice either says that the cell is empty ("miss"), or that the cell belongs to some ship ("hit"). But here 's the problem! Alice like to cheat. May be that is why she responds to each Bob 's move with a "miss". Help Bob catch Alice cheating -- find Bob 's first move, such that after it you can be sure that Alice cheated. The first line of the input contains three integers: n, k and a (1 ≤ n, k, a ≤ 2 ·105) -- the size of the field, the number of the ships and the size of each ship. It is guaranteed that the n, k and a are such that you can put k ships of size a on the field, so that no two ships intersect or touch each other. The second line contains integer m (1 ≤ m ≤ n) -- the number of Bob 's moves. The third line contains m distinct integers x1, x2, ..., xm, where xi is the number of the cell where Bob made the i-th shot. The cells are numbered from left to right from 1 to n. Print a single integer -- the number of such Bob 's first move, after which you can be sure that Alice lied. Bob 's moves are numbered from 1 to m in the order the were made. If the sought move doesn 't exist, then print "-1".

Tutorials

Editorial Codeforces Round #Pi

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
12601860 dr.ikros D Aug. 19, 2015, 11:07 a.m. OK D TESTS 51 312 17408000 1800
18046748 ruban D May 23, 2016, 5:41 p.m. OK Delphi TESTS 51 93 18739200 1800
14564925 neromix188 D Nov. 30, 2015, 3:13 a.m. OK FPC TESTS 51 46 1024000 1800
13542779 Valerich D Oct. 11, 2015, 8:23 a.m. OK FPC TESTS 51 46 17203200 1800
34429817 vjudge3 D Jan. 22, 2018, 2:37 a.m. OK FPC TESTS 51 62 4812800 1800
14554797 ngattaro1 D Nov. 29, 2015, 9:26 a.m. OK FPC TESTS 51 62 5120000 1800
34429780 vjudge4 D Jan. 22, 2018, 2:35 a.m. OK FPC TESTS 51 93 4812800 1800
34429767 1008208820 D Jan. 22, 2018, 2:34 a.m. OK FPC TESTS 51 93 4812800 1800
13722867 Derrick_M D Oct. 19, 2015, 6:52 a.m. OK FPC TESTS 51 436 1638400 1800
18373722 Gray_58 D June 11, 2016, 11:41 a.m. OK FPC TESTS 51 452 4198400 1800
12486954 NoSoul D Aug. 13, 2015, 4:31 a.m. OK GNU C TESTS 51 93 6656000 1800
12636956 kwakwa D Aug. 22, 2015, 5:21 a.m. OK GNU C TESTS 51 124 5017600 1800
17600287 rchehab Nson pedrohlf D April 30, 2016, 8:24 p.m. OK GNU C TESTS 51 264 2867200 1800
21031943 reyad D Sept. 30, 2016, 3:07 p.m. OK GNU C TESTS 51 343 1638400 1800
24717058 vjudge1 D Feb. 16, 2017, noon OK GNU C++ TESTS 51 30 10854400 1800
21509592 zhan8855 D Oct. 17, 2016, 2:02 a.m. OK GNU C++ TESTS 51 31 7884800 1800
12525026 divakar_tomar D Aug. 14, 2015, 7:22 a.m. OK GNU C++ TESTS 51 46 1638400 1800
12898224 vjudge4 D Sept. 8, 2015, 1:34 p.m. OK GNU C++ TESTS 51 62 819200 1800
12601876 Theodor1000 D Aug. 19, 2015, 11:08 a.m. OK GNU C++ TESTS 51 62 819200 1800
13504639 vjudge4 D Oct. 9, 2015, 6:57 a.m. OK GNU C++ TESTS 51 62 1024000 1800
12459576 nishankj96 D Aug. 11, 2015, 12:37 a.m. OK GNU C++ TESTS 51 62 1024000 1800
13108446 osama D Sept. 19, 2015, 11:15 p.m. OK GNU C++ TESTS 51 62 1024000 1800
16438180 Vendetta. D March 1, 2016, 9:06 a.m. OK GNU C++ TESTS 51 62 1024000 1800
16438152 Vendetta. D March 1, 2016, 9:04 a.m. OK GNU C++ TESTS 51 62 1024000 1800
57247396 rainboy D July 17, 2019, 8:10 p.m. OK GNU C11 TESTS 51 62 3174400 1800
46466783 luogu_bot3 D Dec. 2, 2018, 4 a.m. OK GNU C++11 TESTS 51 46 819200 1800
40986313 ReaLNero1 D July 30, 2018, 8:28 p.m. OK GNU C++11 TESTS 51 46 2662400 1800
13854134 dtasfr D Oct. 25, 2015, 1:31 p.m. OK GNU C++11 TESTS 51 46 3379200 1800
13860924 Amir169 D Oct. 25, 2015, 7:58 p.m. OK GNU C++11 TESTS 51 61 3379200 1800
13854146 vjudge4 D Oct. 25, 2015, 1:34 p.m. OK GNU C++11 TESTS 51 61 3379200 1800
16632347 orshih D March 10, 2016, 12:37 p.m. OK GNU C++11 TESTS 51 62 614400 1800
14035134 paruki D Nov. 2, 2015, 11:32 p.m. OK GNU C++11 TESTS 51 62 819200 1800
15391654 alex1 D Jan. 15, 2016, 3:47 p.m. OK GNU C++11 TESTS 51 62 819200 1800
50240374 MohamedSameh D Feb. 20, 2019, 12:41 p.m. OK GNU C++11 TESTS 51 62 1024000 1800
12800223 bayram98 D Sept. 1, 2015, 10:39 a.m. OK GNU C++11 TESTS 51 62 1228800 1800
56373209 sabertooth D July 1, 2019, 5:08 a.m. OK GNU C++14 TESTS 51 62 1024000 1800
56768656 vjudge3 D July 9, 2019, 7:57 p.m. OK GNU C++14 TESTS 51 62 1024000 1800
25958470 prashanttyagi D March 30, 2017, 4:29 p.m. OK GNU C++14 TESTS 51 62 2764800 1800
23664878 mengxiang000 D Jan. 9, 2017, 2:17 p.m. OK GNU C++14 TESTS 51 62 3481600 1800
54483364 Amr_Akmal D May 22, 2019, noon OK GNU C++14 TESTS 51 77 819200 1800
30814499 bu_galala D Sept. 28, 2017, 7:25 p.m. OK GNU C++14 TESTS 51 77 1024000 1800
30213796 Noureldin_Khaled D Sept. 8, 2017, 10:23 p.m. OK GNU C++14 TESTS 51 77 1024000 1800
50040006 danya.smelskiy D Feb. 17, 2019, 12:45 a.m. OK GNU C++14 TESTS 51 77 1024000 1800
30036750 Valour D Sept. 3, 2017, 1:59 p.m. OK GNU C++14 TESTS 51 77 1638400 1800
49487276 ACFirst D Feb. 5, 2019, 6:54 a.m. OK GNU C++14 TESTS 51 78 819200 1800
56605283 vjudge5 D July 6, 2019, 4:04 a.m. OK GNU C++17 TESTS 51 77 1638400 1800
59130565 Mahdi_Shokoufi D Aug. 20, 2019, 10:50 a.m. OK GNU C++17 TESTS 51 78 1024000 1800
59349497 Bars D Aug. 23, 2019, 11:12 a.m. OK GNU C++17 TESTS 51 78 1024000 1800
53755977 Ly20 D May 4, 2019, 6:11 p.m. OK GNU C++17 TESTS 51 78 1126400 1800
56537048 AhmedMohamedFathy D July 5, 2019, 1:56 a.m. OK GNU C++17 TESTS 51 78 1638400 1800
52605407 mu_xia_xiu_ji D April 11, 2019, 1:40 p.m. OK GNU C++17 TESTS 51 78 1638400 1800
49441030 Stroustrup D Feb. 3, 2019, 9:02 p.m. OK GNU C++17 TESTS 51 78 1843200 1800
67484859 N.N_2004 D Dec. 23, 2019, 5:07 p.m. OK GNU C++17 TESTS 51 78 1843200 1800
66245129 Ma7moud.7amdy D Dec. 3, 2019, 8:04 p.m. OK GNU C++17 TESTS 51 78 2457600 1800
48649709 Kavit_Kheni D Jan. 20, 2019, 7:51 p.m. OK GNU C++17 TESTS 51 92 1843200 1800
62657895 synapse D Oct. 16, 2019, 3:20 a.m. OK Go TESTS 51 780 5324800 1800
62657859 synapse D Oct. 16, 2019, 3:18 a.m. OK Go TESTS 51 780 5324800 1800
62657830 synapse D Oct. 16, 2019, 3:16 a.m. OK Go TESTS 51 795 5324800 1800
15378726 behzad.nouri D Jan. 14, 2016, 10:32 p.m. OK Haskell TESTS 51 327 23347200 1800
12844213 maged D Sept. 4, 2015, 6:18 p.m. OK Java 7 TESTS 51 233 1024000 1800
12469620 uagaponec D Aug. 11, 2015, 5:27 p.m. OK Java 7 TESTS 51 295 0 1800
12855364 suigingin D Sept. 5, 2015, 3:35 p.m. OK Java 7 TESTS 51 296 0 1800
12791862 Aldijohn D Aug. 31, 2015, 4:51 p.m. OK Java 7 TESTS 51 296 0 1800
13006512 maitony D Sept. 15, 2015, 11:40 a.m. OK Java 7 TESTS 51 327 0 1800
12665848 miniluigi D Aug. 22, 2015, 10:34 p.m. OK Java 7 TESTS 51 358 11776000 1800
13126388 curly D Sept. 21, 2015, 12:59 p.m. OK Java 7 TESTS 51 358 12185600 1800
18237367 frktry D June 3, 2016, 9:46 p.m. OK Java 7 TESTS 51 358 46182400 1800
18237244 frktry D June 3, 2016, 9:23 p.m. OK Java 7 TESTS 51 374 46182400 1800
12688833 mariusz89016 D Aug. 24, 2015, 8:23 p.m. OK Java 7 TESTS 51 390 0 1800
12639164 NikitaMikhaylov D Aug. 22, 2015, 8:40 a.m. OK Java 8 TESTS 51 140 0 1800
30581038 Ajudiya_13 D Sept. 21, 2017, 2:42 p.m. OK Java 8 TESTS 51 155 0 1800
21002448 parth015 D Sept. 29, 2016, 8:21 p.m. OK Java 8 TESTS 51 156 0 1800
57299137 mennafadali D July 18, 2019, 9:26 p.m. OK Java 8 TESTS 51 156 2048000 1800
60744808 ISSAM_LAKOUAM D Sept. 18, 2019, 12:11 a.m. OK Java 8 TESTS 51 170 2048000 1800
20978335 U_Square D Sept. 28, 2016, 8:06 p.m. OK Java 8 TESTS 51 171 0 1800
23277321 kunalk D Dec. 24, 2016, 6:11 p.m. OK Java 8 TESTS 51 171 20377600 1800
27985108 Ahmed.Shawky D June 23, 2017, 12:39 p.m. OK Java 8 TESTS 51 171 22732800 1800
23687038 OmarRadwan D Jan. 10, 2017, 7:35 p.m. OK Java 8 TESTS 51 171 24678400 1800
20184902 ChrisWu D Aug. 26, 2016, 11:14 p.m. OK Java 8 TESTS 51 171 24780800 1800
45402211 vjudge4 D Nov. 7, 2018, 9:16 a.m. OK MS C++ TESTS 51 62 1024000 1800
45202989 vjudge3 D Nov. 2, 2018, 11:10 a.m. OK MS C++ TESTS 51 78 1843200 1800
12477948 vjudge1 D Aug. 12, 2015, 10:37 a.m. OK MS C++ TESTS 51 93 6451200 1800
12478148 sister_what_hate_most D Aug. 12, 2015, 10:54 a.m. OK MS C++ TESTS 51 108 6451200 1800
12679408 redoak D Aug. 24, 2015, 3:45 a.m. OK MS C++ TESTS 51 124 3276800 1800
12675866 Hro D Aug. 23, 2015, 5:16 p.m. OK MS C++ TESTS 51 124 3276800 1800
12608471 Waldis D Aug. 19, 2015, 7:33 p.m. OK MS C++ TESTS 51 124 4096000 1800
12627448 vjudge2 D Aug. 21, 2015, 11:53 a.m. OK MS C++ TESTS 51 124 6451200 1800
12627332 vjudge3 D Aug. 21, 2015, 11:44 a.m. OK MS C++ TESTS 51 124 6451200 1800
14933694 uptimist D Dec. 23, 2015, 6:01 a.m. OK MS C++ TESTS 51 124 7270400 1800
59094505 liuhb D Aug. 19, 2019, 1:45 p.m. OK MS C++ 2017 TESTS 51 218 7270400 1800
63662851 CtrlAlt D Oct. 28, 2019, 2:22 p.m. OK MS C++ 2017 TESTS 51 249 3174400 1800
64368589 Still_Theory D Nov. 6, 2019, 1:40 p.m. OK MS C++ 2017 TESTS 51 249 4915200 1800
59915600 areo D Sept. 2, 2019, 7:03 p.m. OK MS C++ 2017 TESTS 51 280 6451200 1800
59094988 liuhb D Aug. 19, 2019, 1:55 p.m. OK MS C++ 2017 TESTS 51 311 7270400 1800
58703844 printfok D Aug. 13, 2019, 8:45 a.m. OK MS C++ 2017 TESTS 51 327 6451200 1800
13744468 DarthShrine D Oct. 20, 2015, 3:17 a.m. OK Ocaml TESTS 51 920 12083200 1800
12661173 allanyin D Aug. 22, 2015, 6:15 p.m. OK PyPy 2 TESTS 51 702 11776000 1800
13894427 nealzane D Oct. 27, 2015, 3:39 p.m. OK PyPy 2 TESTS 51 717 14028800 1800
42353282 Onesh0t D Sept. 2, 2018, 7:01 a.m. OK PyPy 2 TESTS 51 873 16691200 1800
67585896 r57shell D Dec. 25, 2019, 8:16 a.m. OK PyPy 3 TESTS 51 795 19968000 1800
44278313 homoeconomicus D Oct. 14, 2018, 1:09 a.m. OK PyPy 3 TESTS 51 841 28979200 1800
35893779 _____k_____ D March 3, 2018, 4:07 p.m. OK PyPy 3 TESTS 51 888 41164800 1800
35888550 ______n______ D March 3, 2018, 2:25 p.m. OK PyPy 3 TESTS 51 888 41164800 1800
35887040 _____i_____ D March 3, 2018, 1:57 p.m. OK PyPy 3 TESTS 51 888 41164800 1800
35883269 ______h______ D March 3, 2018, 12:51 p.m. OK PyPy 3 TESTS 51 888 41164800 1800
35882902 ______k______ D March 3, 2018, 12:45 p.m. OK PyPy 3 TESTS 51 888 41164800 1800
35875320 ______i______ D March 3, 2018, 8:14 a.m. OK PyPy 3 TESTS 51 888 41164800 1800
35873653 ______M______ D March 3, 2018, 7:34 a.m. OK PyPy 3 TESTS 51 888 41164800 1800
17363576 wujuihsuan2016 D April 17, 2016, 12:04 p.m. OK PyPy 3 TESTS 51 998 39731200 1800
12480369 eglur D Aug. 12, 2015, 1:43 p.m. OK Scala TESTS 51 873 1740800 1800

remove filters

Back to search problems