# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
69260 | 2018-08-20T10:36:25 Z | Bruteforceman | 고대 책들 (IOI17_books) | C++11 | 6 ms | 700 KB |
#include "books.h" #include "bits/stdc++.h" using namespace std; long long minimum_walk(std::vector<int> p, int s) { bool good = true; for(int i = 0; i < p.size(); i++) { if(p[i] != i) { good = false; } } if(good) return 0; int l = 0; int r = p.size() - 1; long long ans = 0; while(l < p.size() && p[l] == l) { if(s == l) { ans += 2; ++s; } ++l; } while(r >= 0 && p[r] == r) { if(s == r) { ans += 2; --s; } --r; } for(int i = l; i < r; i++) { int go_left = 0; int go_right = 0; for(int j = l; j <= i; j++) { if(p[j] > i) { ++go_left; } } for(int j = i + 1; j <= r; j++) { if(p[j] < i+1) { ++go_right; } } assert(go_left == go_right); ans += go_left + go_right; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 3 ms | 416 KB | Output is correct |
5 | Correct | 2 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 3 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 3 ms | 656 KB | Output is correct |
12 | Correct | 2 ms | 700 KB | Output is correct |
13 | Correct | 3 ms | 700 KB | Output is correct |
14 | Correct | 3 ms | 700 KB | Output is correct |
15 | Correct | 4 ms | 700 KB | Output is correct |
16 | Correct | 2 ms | 700 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 2 ms | 700 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 3 ms | 416 KB | Output is correct |
5 | Correct | 2 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 3 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 3 ms | 656 KB | Output is correct |
12 | Correct | 2 ms | 700 KB | Output is correct |
13 | Correct | 3 ms | 700 KB | Output is correct |
14 | Correct | 3 ms | 700 KB | Output is correct |
15 | Correct | 4 ms | 700 KB | Output is correct |
16 | Correct | 2 ms | 700 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 2 ms | 700 KB | Output is correct |
19 | Correct | 3 ms | 700 KB | Output is correct |
20 | Correct | 6 ms | 700 KB | Output is correct |
21 | Correct | 3 ms | 700 KB | Output is correct |
22 | Incorrect | 5 ms | 700 KB | 3rd lines differ - on the 1st token, expected: '2082', found: '788' |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 3 ms | 416 KB | Output is correct |
5 | Correct | 2 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 3 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 3 ms | 656 KB | Output is correct |
12 | Correct | 2 ms | 700 KB | Output is correct |
13 | Correct | 3 ms | 700 KB | Output is correct |
14 | Correct | 3 ms | 700 KB | Output is correct |
15 | Correct | 4 ms | 700 KB | Output is correct |
16 | Correct | 2 ms | 700 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 2 ms | 700 KB | Output is correct |
19 | Correct | 3 ms | 700 KB | Output is correct |
20 | Correct | 6 ms | 700 KB | Output is correct |
21 | Correct | 3 ms | 700 KB | Output is correct |
22 | Incorrect | 5 ms | 700 KB | 3rd lines differ - on the 1st token, expected: '2082', found: '788' |
23 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 700 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 3 ms | 416 KB | Output is correct |
5 | Correct | 2 ms | 604 KB | Output is correct |
6 | Correct | 2 ms | 604 KB | Output is correct |
7 | Correct | 3 ms | 604 KB | Output is correct |
8 | Correct | 2 ms | 604 KB | Output is correct |
9 | Correct | 2 ms | 604 KB | Output is correct |
10 | Correct | 3 ms | 640 KB | Output is correct |
11 | Correct | 3 ms | 656 KB | Output is correct |
12 | Correct | 2 ms | 700 KB | Output is correct |
13 | Correct | 3 ms | 700 KB | Output is correct |
14 | Correct | 3 ms | 700 KB | Output is correct |
15 | Correct | 4 ms | 700 KB | Output is correct |
16 | Correct | 2 ms | 700 KB | Output is correct |
17 | Correct | 3 ms | 700 KB | Output is correct |
18 | Correct | 2 ms | 700 KB | Output is correct |
19 | Correct | 3 ms | 700 KB | Output is correct |
20 | Correct | 6 ms | 700 KB | Output is correct |
21 | Correct | 3 ms | 700 KB | Output is correct |
22 | Incorrect | 5 ms | 700 KB | 3rd lines differ - on the 1st token, expected: '2082', found: '788' |
23 | Halted | 0 ms | 0 KB | - |