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'Ray lost his array and needs to find it by asking Omkar. Omkar is willing to disclose that the array has the following qualities: Ray is allowed to send Omkar a series of queries. A query consists of two integers, l and r such that 1 <= l <= r <= n . Omkar will respond with two integers, x and f . x is the mode of the subarray from index l to index r inclusive. The mode of an array is defined by the number that appears the most frequently. If there are multiple numbers that appear the most number of times, the smallest such number is considered to be the mode. f is the amount of times that x appears in the queried subarray. The array has k ( 1 <= k <= min(25000,n) ) distinct elements. However, due to Ray 's sins, Omkar will not tell Ray what k is. Ray is allowed to send at most 4k queries. Help Ray find his lost array. The only line of the input contains a single integer n ( 1 <= n <= 2 cdot 10^5 ), which equals to the length of the array that you are trying to find. The interaction starts with reading n . Then you can make one type of query: The answer to each query will be in the form " x enspace f " where x is the mode of the subarray and f is the number of times x appears in the subarray. To output your answer, print: And quit after that. This query is not counted towards the 4k queries limit. After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use: Hack Format To hack, output 1 integer on the first line, n ( 1 <= n <= 2 cdot 10^5 ). On the second line output n integers a_1, a_2, ldots, a_{n-1}, a_n separated by a space such that there are at most 25000 distinct numbers and a_j <= a_{j+1} for all j from 1 to n-1 . The first query is l=1 and r=6 . The mode is 2'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
86602914 |
yao11617 |
F |
July 11, 2020, 8:26 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
312 |
7884800 |
|
2800 |
86602982 |
yao11617 |
F |
July 11, 2020, 8:27 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
483 |
4812800 |
|
2800 |
86596439 |
lbjlc |
F |
July 11, 2020, 6:45 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
545 |
7065600 |
|
2800 |
86615689 |
Frame233 |
F |
July 12, 2020, 3:36 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
560 |
4710400 |
|
2800 |
86575729 |
21_din_me_paisa_double |
F |
July 11, 2020, 4:20 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
654 |
6246400 |
|
2800 |
86618851 |
shengzihang |
F |
July 12, 2020, 4:44 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
655 |
5939200 |
|
2800 |
86618495 |
caidzh |
F |
July 12, 2020, 4:38 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
685 |
4710400 |
|
2800 |
86617786 |
SleepZzz |
F |
July 12, 2020, 4:24 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
967 |
4710400 |
|
2800 |
86599240 |
parfe211 |
F |
July 11, 2020, 7:21 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
982 |
8294400 |
|
2800 |
86608139 |
krijgertje |
F |
July 11, 2020, 11:30 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
499 |
4608000 |
|
2800 |
86615207 |
awholenewworld |
F |
July 12, 2020, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
702 |
6656000 |
|
2800 |
86592979 |
Zoli9 |
F |
July 11, 2020, 6:15 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
716 |
7884800 |
|
2800 |
86602650 |
xsc |
F |
July 11, 2020, 8:20 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
732 |
4812800 |
|
2800 |
86601333 |
real.emerald |
F |
July 11, 2020, 7:55 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
748 |
4505600 |
|
2800 |
86607535 |
alleviatedRules |
F |
July 11, 2020, 10:58 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
764 |
4608000 |
|
2800 |
86611836 |
MarcosK |
F |
July 12, 2020, 1:59 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
795 |
4505600 |
|
2800 |
86600804 |
real.emerald |
F |
July 11, 2020, 7:46 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
810 |
4608000 |
|
2800 |
86616807 |
manu |
F |
July 12, 2020, 4:02 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
873 |
4505600 |
|
2800 |
86593663 |
danya090699 |
F |
July 11, 2020, 6:20 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
951 |
6451200 |
|
2800 |
remove filters
Back to search problems