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'Pak Chanek is visiting a kingdom that earned a nickname "Kingdom of Criticism" because of how often its residents criticise each aspect of the kingdom. One aspect that is often criticised is the heights of the buildings. The kingdom has N buildings. Initially, building i has a height of A_i units. At any point in time, the residents can give a new criticism, namely they currently do not like buildings with heights between l and r units inclusive for some two integers l and r . It is known that r-l is always odd. In 1 minute, the kingdom 's construction team can increase or decrease the height of any building by 1 unit as long as the height still becomes a positive number. Each time they receive the current criticism from the residents, the kingdom 's construction team makes it so that there are no buildings with heights between l and r units inclusive in the minimum time possible. It can be obtained that there is only one way to do this. Note that the construction team only cares about the current criticism from the residents. All previous criticisms are forgotten. There will be Q queries that you must solve. Each query is one of the three following possibilities: Note that each change in height still persists to the next queries. The first line contains a single integer N ( 1 <= q N <= q 4 cdot 10^5 ) -- the number buildings in the kingdom. The second line contains N integers A_1, A_2, ldots, A_N ( 1 <= q A_i <= q 10^9 ) -- the initial heights of the buildings. The next line contains a single integer Q ( 1 <= q Q <= q 4 cdot 10^5 ) -- the number of queries. The j -th of the next Q lines contains the j -th query as described. There is at least one query of type 2 . For each query of type 2 , output a line containing an integer representing the height of the building asked. After the 1 -st query, the height of'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
170869210 |
kaiboy rainboy Dukkha |
K |
Sept. 4, 2022, 4:04 p.m. |
OK |
GNU C11 |
TESTS |
35 |
2776 |
278937600 |
|
|
170875421 |
alek0618 RGB_ICPC7 RGB_ICPC1 |
K |
Sept. 4, 2022, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
1326 |
471961600 |
|
|
170903989 |
rfpermen |
K |
Sept. 5, 2022, 2:03 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
1980 |
330342400 |
|
|
170860066 |
Mr_Eight wangziji Qingyu |
K |
Sept. 4, 2022, 2:53 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
2074 |
90726400 |
|
|
170881241 |
_Veritas 285087101 FNOIwyhao |
K |
Sept. 4, 2022, 6:04 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
2089 |
24064000 |
|
|
170903679 |
rfpermen |
K |
Sept. 5, 2022, 1:55 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
2183 |
458547200 |
|
|
170903920 |
rfpermen |
K |
Sept. 5, 2022, 2:01 a.m. |
OK |
GNU C++14 |
TESTS |
35 |
2230 |
338329600 |
|
|
170854624 |
OPsigma |
K |
Sept. 4, 2022, 2:20 p.m. |
OK |
GNU C++14 |
TESTS |
35 |
2979 |
156672000 |
|
|
170853267 |
rapira FeggieBoss Astronomax |
K |
Sept. 4, 2022, 2:13 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
717 |
43520000 |
|
|
170901764 |
faustaadp |
K |
Sept. 5, 2022, 12:59 a.m. |
OK |
GNU C++17 |
TESTS |
35 |
1138 |
54169600 |
|
|
170881090 |
Agreb |
K |
Sept. 4, 2022, 6:02 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
1200 |
50995200 |
|
|
170883748 |
Kotoblepass s20b1_chernikov average_gleb_enjoyer |
K |
Sept. 4, 2022, 6:30 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
1482 |
264396800 |
|
|
170875102 |
fenzhang hiwang123 spentplaying |
K |
Sept. 4, 2022, 4:56 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
1560 |
73420800 |
|
|
170858304 |
yyljkydr Suika_predator oipotato |
K |
Sept. 4, 2022, 2:42 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
1840 |
12800000 |
|
|
170868180 |
Pajaraja milisav allllekssssa |
K |
Sept. 4, 2022, 3:56 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
1918 |
124108800 |
|
|
170879772 |
Gmacem |
K |
Sept. 4, 2022, 5:46 p.m. |
OK |
GNU C++17 |
TESTS |
35 |
2948 |
87961600 |
|
|
170890751 |
alwyn |
K |
Sept. 4, 2022, 8:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
904 |
54579200 |
|
|
170869013 |
PIachta Sophie_Neuenmuller |
K |
Sept. 4, 2022, 4:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1013 |
120934400 |
|
|
170890643 |
alwyn |
K |
Sept. 4, 2022, 8:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1154 |
54579200 |
|
|
170890573 |
alwyn |
K |
Sept. 4, 2022, 8:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1263 |
54579200 |
|
|
170869369 |
PIachta Sophie_Neuenmuller |
K |
Sept. 4, 2022, 4:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1294 |
86732800 |
|
|
170866606 |
kotatsugame |
K |
Sept. 4, 2022, 3:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1730 |
248012800 |
|
|
170904962 |
beza |
K |
Sept. 5, 2022, 2:32 a.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
1824 |
113049600 |
|
|
170888530 |
TsukasaYuzaki |
K |
Sept. 4, 2022, 7:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
2043 |
464896000 |
|
|
170887780 |
TsukasaYuzaki |
K |
Sept. 4, 2022, 7:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
2089 |
464896000 |
|
|
170871153 |
errorgorn |
K |
Sept. 4, 2022, 4:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
35 |
2308 |
396390400 |
|
|
170900012 |
CoderNTT |
K |
Sept. 5, 2022, 12:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
763 |
91136000 |
|
|
170872162 |
akifpatel jdurie |
K |
Sept. 4, 2022, 4:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
764 |
57856000 |
|
|
170862718 |
Heltion |
K |
Sept. 4, 2022, 3:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
795 |
46592000 |
|
|
170886825 |
Thallium54 |
K |
Sept. 4, 2022, 7:09 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
810 |
51404800 |
|
|
170858675 |
jiangly |
K |
Sept. 4, 2022, 2:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
842 |
51404800 |
|
|
170873188 |
I_LOVE_DASHA_KARPENKO Wailydest oleh1421 |
K |
Sept. 4, 2022, 4:38 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
904 |
87654400 |
|
|
170880245 |
Nero |
K |
Sept. 4, 2022, 5:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
920 |
75468800 |
|
|
170912553 |
noshin_faiza Roll_Num_56 Iftekhar_Hakim_K |
K |
Sept. 5, 2022, 5:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
966 |
82739200 |
|
|
170902561 |
Zanite |
K |
Sept. 5, 2022, 1:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
997 |
80281600 |
|
|
170871179 |
fastmath turmax LeoPro |
K |
Sept. 4, 2022, 4:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
35 |
1122 |
111308800 |
|
|
170869531 |
arvindf232 happypotato1207 nicholask |
K |
Sept. 4, 2022, 4:07 p.m. |
OK |
Kotlin 1.6 |
TESTS |
35 |
1481 |
53043200 |
|
|
remove filters
Back to search problems