답안 #914065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914065 2024-01-21T02:15:34 Z nightfal 고대 책들 (IOI17_books) C++14
50 / 100
129 ms 18784 KB
#include <cstdio>
#include <vector>
#include <cassert>
#include <cstdlib>

using namespace std;

bool isSubtask3(int s) { return s==0;}

long long subtask3(vector<int> p, int s) {
    int n = p.size(), last = 0;
    long long total = 0;

    for(int i=0; i<n; i++) {
        if (i==p[i]) continue;
        if(i>last) total += (i-last)*2;
        total += abs(p[i]-i);

        last = max(last,i);
        int idx = p[i]; p[i] = i;
        while(idx!=i) {
            last = max(last,idx);
            total += abs(p[idx]-idx); 
            int prevIdx = idx; 
            idx = p[idx];
            p[prevIdx] = prevIdx;
        }
    }
	return total;
}

long long fulltask(vector<int> p, int s) {
    return 0;
}

long long minimum_walk(std::vector<int> p, int s) {
    if (isSubtask3(s)) return subtask3(p,s);
    return fulltask(p,s);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 0 ms 424 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 0 ms 424 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 496 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 504 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 420 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 0 ms 424 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 496 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 504 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 420 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 128 ms 18640 KB Output is correct
31 Correct 129 ms 18772 KB Output is correct
32 Correct 74 ms 18772 KB Output is correct
33 Correct 105 ms 18772 KB Output is correct
34 Correct 97 ms 18784 KB Output is correct
35 Correct 79 ms 18772 KB Output is correct
36 Correct 78 ms 18784 KB Output is correct
37 Correct 77 ms 18644 KB Output is correct
38 Correct 78 ms 18772 KB Output is correct
39 Correct 78 ms 18784 KB Output is correct
40 Correct 79 ms 18772 KB Output is correct
41 Correct 96 ms 18640 KB Output is correct
42 Correct 85 ms 18768 KB Output is correct
43 Correct 118 ms 18772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '3304', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 0 ms 424 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 500 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 356 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 496 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 504 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 420 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 128 ms 18640 KB Output is correct
31 Correct 129 ms 18772 KB Output is correct
32 Correct 74 ms 18772 KB Output is correct
33 Correct 105 ms 18772 KB Output is correct
34 Correct 97 ms 18784 KB Output is correct
35 Correct 79 ms 18772 KB Output is correct
36 Correct 78 ms 18784 KB Output is correct
37 Correct 77 ms 18644 KB Output is correct
38 Correct 78 ms 18772 KB Output is correct
39 Correct 78 ms 18784 KB Output is correct
40 Correct 79 ms 18772 KB Output is correct
41 Correct 96 ms 18640 KB Output is correct
42 Correct 85 ms 18768 KB Output is correct
43 Correct 118 ms 18772 KB Output is correct
44 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '3304', found: '0'
45 Halted 0 ms 0 KB -