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.
Problems
B'There is a strip with an infinite number of cells. Cells are numbered starting with 0 . Initially the cell i contains a ball with the number i . There are n pockets located at cells a_1, ldots, a_n . Each cell contains at most one pocket. Filtering is the following sequence of operations: Note that after each filtering operation each cell will still contain exactly one ball. For example, let the cells 1 , 3 and 4 contain pockets. The initial configuration of balls is shown below (underscores display the cells with pockets): After opening and closing the pockets, balls 1, 3 and 4 disappear: After moving all the balls to the left, the configuration looks like this: Another filtering repetition results in the following: You have to answer m questions. The i -th of these questions is "what is the number of the ball located at the cell x_i after k_i repetitions of the filtering operation?" The first line contains two integers n and m -- the number of pockets and questions respectively ( 1 <= q n, m <= q 10^5 ). The following line contains n integers a_1, ldots, a_n -- the numbers of cells containing pockets ( 0 <= q a_1 < ldots < a_n <= q 10^9 ). The following m lines describe questions. The i -th of these lines contains two integers x_i and k_i ( 0 <= q x_i, k_i <= q 10^9 ). Print m numbers -- answers to the questions, in the same order as given in the input. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
61396288 |
yyf0309 |
G |
Sept. 28, 2019, 2:27 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
140 |
6451200 |
|
3300 |
43985255 |
phtniit |
G |
Oct. 8, 2018, 6:40 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
187 |
14336000 |
|
3300 |
57868266 |
lopare |
G |
July 27, 2019, 11:04 p.m. |
OK |
GNU C++11 |
TESTS |
15 |
249 |
7884800 |
|
3300 |
57736205 |
py_ultron |
G |
July 25, 2019, 10:01 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
249 |
7884800 |
|
3300 |
55527432 |
Winniechen |
G |
June 13, 2019, 11:52 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
249 |
7884800 |
|
3300 |
44037805 |
krijgertje |
G |
Oct. 9, 2018, 1:34 p.m. |
OK |
GNU C++11 |
TESTS |
15 |
280 |
7987200 |
|
3300 |
43879713 |
FizzyDavid |
G |
Oct. 6, 2018, 4:36 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
280 |
102400000 |
|
3300 |
43939195 |
phtniit |
G |
Oct. 7, 2018, 10:35 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
295 |
23347200 |
|
3300 |
44751286 |
ReaLNero1 |
G |
Oct. 23, 2018, 8:04 p.m. |
OK |
GNU C++11 |
TESTS |
15 |
295 |
102400000 |
|
3300 |
45035609 |
Panole233 |
G |
Oct. 29, 2018, 7:31 a.m. |
OK |
GNU C++11 |
TESTS |
15 |
296 |
12288000 |
|
3300 |
63101232 |
mayaohua2003 |
G |
Oct. 22, 2019, 12:44 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
218 |
125030400 |
|
3300 |
44724958 |
TieuMan |
G |
Oct. 23, 2018, 7:36 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
280 |
9216000 |
|
3300 |
67673827 |
Benq |
G |
Dec. 26, 2019, 10:46 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
342 |
19968000 |
|
3300 |
67673874 |
Benq |
G |
Dec. 26, 2019, 10:50 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
358 |
19968000 |
|
3300 |
44030142 |
TieuMan |
G |
Oct. 9, 2018, 10:16 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
404 |
9216000 |
|
3300 |
43944343 |
consecutivelimit |
G |
Oct. 7, 2018, 12:59 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
499 |
26419200 |
|
3300 |
44039599 |
irakli21 |
G |
Oct. 9, 2018, 2:12 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
514 |
123494400 |
|
3300 |
44020164 |
apiadu |
G |
Oct. 9, 2018, 3:05 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
576 |
123494400 |
|
3300 |
44543288 |
yhx-12243 |
G |
Oct. 19, 2018, 12:27 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
608 |
244019200 |
|
3300 |
67661914 |
Benq |
G |
Dec. 26, 2019, 4:11 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
779 |
68608000 |
|
3300 |
69663640 |
gongsuidashen |
G |
Jan. 28, 2020, 10:27 a.m. |
OK |
GNU C++17 |
TESTS |
15 |
171 |
6451200 |
|
3300 |
55396474 |
CMXRYNP |
G |
June 10, 2019, noon |
OK |
GNU C++17 |
TESTS |
15 |
280 |
7987200 |
|
3300 |
52748451 |
vjudge4 |
G |
April 14, 2019, 12:50 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
312 |
12390400 |
|
3300 |
62175765 |
xz153531 |
G |
Oct. 9, 2019, 3:56 a.m. |
OK |
GNU C++17 |
TESTS |
15 |
327 |
11878400 |
|
3300 |
44818689 |
pyBlob |
G |
Oct. 24, 2018, 11:44 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
390 |
27545600 |
|
3300 |
45030725 |
012-28876-Margulan-7 |
G |
Oct. 29, 2018, 3:39 a.m. |
OK |
GNU C++17 |
TESTS |
15 |
405 |
27545600 |
|
3300 |
44269842 |
FanomYT |
G |
Oct. 13, 2018, 6:29 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
468 |
26419200 |
|
3300 |
45143823 |
TohnoYouki |
G |
Oct. 31, 2018, 3:50 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
1060 |
14643200 |
|
3300 |
remove filters
Back to search problems