Submission #3226732
Source Code Expand
N = int(input()) p = [int(input()) for _ in range(N)] q = [0] * N for i in range(N): q[p[i] - 1] = i cnt = 0 ma = 0 for i in range(N - 1): if q[i] < q[i + 1]: cnt += 1 ma = max(ma, cnt) else: cnt = 0 print(N - 1 - ma)
Submission Info
Submission Time | |
---|---|
Task | B - Backfront |
User | poina |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 266 Byte |
Status | AC |
Exec Time | 454 ms |
Memory | 18888 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 412 ms | 18868 KB |
02.txt | AC | 405 ms | 18888 KB |
03.txt | AC | 411 ms | 18888 KB |
04.txt | AC | 415 ms | 18868 KB |
05.txt | AC | 428 ms | 18868 KB |
06.txt | AC | 416 ms | 18868 KB |
07.txt | AC | 444 ms | 18860 KB |
08.txt | AC | 446 ms | 18884 KB |
09.txt | AC | 389 ms | 18868 KB |
10.txt | AC | 366 ms | 18868 KB |
11.txt | AC | 454 ms | 18888 KB |
12.txt | AC | 421 ms | 18868 KB |
13.txt | AC | 439 ms | 18864 KB |
14.txt | AC | 429 ms | 18864 KB |
15.txt | AC | 437 ms | 18888 KB |
16.txt | AC | 424 ms | 18888 KB |
17.txt | AC | 413 ms | 18888 KB |
18.txt | AC | 432 ms | 18868 KB |
19.txt | AC | 423 ms | 18860 KB |
20.txt | AC | 449 ms | 18860 KB |
21.txt | AC | 429 ms | 18864 KB |
22.txt | AC | 417 ms | 18864 KB |
23.txt | AC | 17 ms | 3060 KB |
24.txt | AC | 17 ms | 3064 KB |
25.txt | AC | 17 ms | 3060 KB |
s1.txt | AC | 17 ms | 3060 KB |
s2.txt | AC | 17 ms | 3060 KB |
s3.txt | AC | 17 ms | 2940 KB |