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 |
| 2011
|
Kotlin Heroes: Episode 11 |
FINISHED |
False |
9000 |
48785084 |
Sept. 30, 2024, 2:35 p.m. |
Problems
You are given a permutation (p) of length (n). You can perform operations of two types: mark all positions (i) such that (1 \le i < n) and (p_i < p_{i + 1}), and simultaneously remove the elements at these positions; mark all positions (i) such that (2 \le i \le n) and (p_{i - 1} > p_i), and simultaneously remove the elements at these positions. For each integer from (1) to ((n-1)), calculate the minimum number of operations required to remove that integer from the permutation. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains a single integer (n) ((2 \le n \le 250\,000)). The second line of each test case contains (n) integers (p_1, p_2, \dots, p_n) ((1 \le p_i \le n)). The array (p) is a permutation. Additional constraints on the input: the sum of (n) over all test cases does not exceed (250\,000). For each test case, print ((n-1)) integers. The (i)-th of them should be equal to the minimum number of operations required to remove (i) from the permutation. |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
283839851 |
cmk666 |
G |
Oct. 1, 2024, 2:54 a.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1358 |
175718400 |
|
|
|
283839675 |
wsyear |
G |
Oct. 1, 2024, 2:51 a.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1374 |
234700800 |
|
|
|
283790580 |
andreyDagger |
G |
Sept. 30, 2024, 4:05 p.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1609 |
172032000 |
|
|
|
283796047 |
Egor |
G |
Sept. 30, 2024, 4:40 p.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1624 |
247500800 |
|
|
|
283792095 |
uwi |
G |
Sept. 30, 2024, 4:15 p.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1718 |
204902400 |
|
|
|
283797024 |
IsaacMoris |
G |
Sept. 30, 2024, 4:46 p.m. |
OK |
Kotlin 1.7 |
TESTS |
27 |
1968 |
240640000 |
|
|
|
283798445 |
Heart_Blue |
G |
Sept. 30, 2024, 4:55 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
640 |
24678400 |
|
|
|
283797039 |
nuip |
G |
Sept. 30, 2024, 4:46 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
687 |
19046400 |
|
|
|
283793449 |
Potassium |
G |
Sept. 30, 2024, 4:23 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
890 |
53964800 |
|
|
|
283783797 |
arvindf232 |
G |
Sept. 30, 2024, 3:24 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
906 |
8396800 |
|
|
|
283793076 |
mban259 |
G |
Sept. 30, 2024, 4:21 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
937 |
33792000 |
|
|
|
283804937 |
ilovefsy |
G |
Sept. 30, 2024, 5:37 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
999 |
11571200 |
|
|
|
283787392 |
errorgorn |
G |
Sept. 30, 2024, 3:46 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1030 |
14233600 |
|
|
|
283835755 |
Sparkle_Twilight |
G |
Oct. 1, 2024, 1:28 a.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1031 |
11264000 |
|
|
|
283805082 |
ilovefsy |
G |
Sept. 30, 2024, 5:38 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1031 |
11264000 |
|
|
|
283842284 |
marvinthang |
G |
Oct. 1, 2024, 3:34 a.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1171 |
26009600 |
|
|
remove filters
Back to search problems