# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
51310 | 2018-06-17T12:43:21 Z | ho94949 | Rope (JOI17_rope) | C++17 | 2500 ms | 3216 KB |
#include<bits/stdc++.h> using namespace std; int N, K; int arr[1010101]; int ans[1010101]; int main() { scanf("%d%d", &N, &K); for(int i=0; i<N; ++i) scanf("%d", arr+i); for(int i=1; i<=K; ++i) ans[i] = 0x3f3f3f3f; for(int i=1; i<=K; ++i) for(int j=1; j<=K; ++j) { int v1 = 0, v2 = 0; for(int k=0; k<N/2; ++k) { int l = arr[2*k], r = arr[2*k+1]; if(l==r && (l==i || l==j)) v1 += 2; else if(l==i || l==j || r==i || r==j) ++v1; } if(N%2==1 && (arr[N-1] == i || arr[N-1] == j)) ++v1; if(arr[0] == i || arr[0] == j) ++ v2; for(int k=0; k<(N-1)/2; ++k) { int l = arr[2*k+1], r = arr[2*k+2]; if(l==r && (l==i || l==j)) v2 += 2; else if(l==i || l==j || r==i || r==j) ++v2; } if(N%2==0 && (arr[N-1] == i || arr[N-1] == j)) ++v2; //printf("%d %d %d %d\n", i, j, v1, v2); ans[i] = min(ans[i], N-max(v1, v2)); ans[j] = min(ans[j], N-max(v1, v2)); } for(int i=1; i<=K; ++i) printf("%d\n", ans[i]); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 496 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Correct | 2 ms | 788 KB | Output is correct |
11 | Correct | 2 ms | 788 KB | Output is correct |
12 | Correct | 2 ms | 788 KB | Output is correct |
13 | Correct | 2 ms | 788 KB | Output is correct |
14 | Correct | 2 ms | 788 KB | Output is correct |
15 | Correct | 2 ms | 788 KB | Output is correct |
16 | Correct | 2 ms | 788 KB | Output is correct |
17 | Correct | 2 ms | 788 KB | Output is correct |
18 | Correct | 2 ms | 788 KB | Output is correct |
19 | Correct | 2 ms | 788 KB | Output is correct |
20 | Correct | 2 ms | 788 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 2 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 908 KB | Output is correct |
26 | Correct | 2 ms | 908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 496 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Correct | 2 ms | 788 KB | Output is correct |
11 | Correct | 2 ms | 788 KB | Output is correct |
12 | Correct | 2 ms | 788 KB | Output is correct |
13 | Correct | 2 ms | 788 KB | Output is correct |
14 | Correct | 2 ms | 788 KB | Output is correct |
15 | Correct | 2 ms | 788 KB | Output is correct |
16 | Correct | 2 ms | 788 KB | Output is correct |
17 | Correct | 2 ms | 788 KB | Output is correct |
18 | Correct | 2 ms | 788 KB | Output is correct |
19 | Correct | 2 ms | 788 KB | Output is correct |
20 | Correct | 2 ms | 788 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 2 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 908 KB | Output is correct |
26 | Correct | 2 ms | 908 KB | Output is correct |
27 | Correct | 81 ms | 1288 KB | Output is correct |
28 | Correct | 30 ms | 1504 KB | Output is correct |
29 | Correct | 72 ms | 1800 KB | Output is correct |
30 | Correct | 37 ms | 1928 KB | Output is correct |
31 | Correct | 85 ms | 2148 KB | Output is correct |
32 | Correct | 31 ms | 2356 KB | Output is correct |
33 | Correct | 73 ms | 2552 KB | Output is correct |
34 | Correct | 37 ms | 2764 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 496 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Correct | 2 ms | 788 KB | Output is correct |
11 | Correct | 2 ms | 788 KB | Output is correct |
12 | Correct | 2 ms | 788 KB | Output is correct |
13 | Correct | 2 ms | 788 KB | Output is correct |
14 | Correct | 2 ms | 788 KB | Output is correct |
15 | Correct | 2 ms | 788 KB | Output is correct |
16 | Correct | 2 ms | 788 KB | Output is correct |
17 | Correct | 2 ms | 788 KB | Output is correct |
18 | Correct | 2 ms | 788 KB | Output is correct |
19 | Correct | 2 ms | 788 KB | Output is correct |
20 | Correct | 2 ms | 788 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 2 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 908 KB | Output is correct |
26 | Correct | 2 ms | 908 KB | Output is correct |
27 | Correct | 81 ms | 1288 KB | Output is correct |
28 | Correct | 30 ms | 1504 KB | Output is correct |
29 | Correct | 72 ms | 1800 KB | Output is correct |
30 | Correct | 37 ms | 1928 KB | Output is correct |
31 | Correct | 85 ms | 2148 KB | Output is correct |
32 | Correct | 31 ms | 2356 KB | Output is correct |
33 | Correct | 73 ms | 2552 KB | Output is correct |
34 | Correct | 37 ms | 2764 KB | Output is correct |
35 | Execution timed out | 2567 ms | 3216 KB | Time limit exceeded |
36 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 496 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Correct | 2 ms | 788 KB | Output is correct |
11 | Correct | 2 ms | 788 KB | Output is correct |
12 | Correct | 2 ms | 788 KB | Output is correct |
13 | Correct | 2 ms | 788 KB | Output is correct |
14 | Correct | 2 ms | 788 KB | Output is correct |
15 | Correct | 2 ms | 788 KB | Output is correct |
16 | Correct | 2 ms | 788 KB | Output is correct |
17 | Correct | 2 ms | 788 KB | Output is correct |
18 | Correct | 2 ms | 788 KB | Output is correct |
19 | Correct | 2 ms | 788 KB | Output is correct |
20 | Correct | 2 ms | 788 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 2 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 908 KB | Output is correct |
26 | Correct | 2 ms | 908 KB | Output is correct |
27 | Correct | 81 ms | 1288 KB | Output is correct |
28 | Correct | 30 ms | 1504 KB | Output is correct |
29 | Correct | 72 ms | 1800 KB | Output is correct |
30 | Correct | 37 ms | 1928 KB | Output is correct |
31 | Correct | 85 ms | 2148 KB | Output is correct |
32 | Correct | 31 ms | 2356 KB | Output is correct |
33 | Correct | 73 ms | 2552 KB | Output is correct |
34 | Correct | 37 ms | 2764 KB | Output is correct |
35 | Execution timed out | 2567 ms | 3216 KB | Time limit exceeded |
36 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
5 | Correct | 2 ms | 488 KB | Output is correct |
6 | Correct | 2 ms | 496 KB | Output is correct |
7 | Correct | 2 ms | 592 KB | Output is correct |
8 | Correct | 2 ms | 656 KB | Output is correct |
9 | Correct | 2 ms | 660 KB | Output is correct |
10 | Correct | 2 ms | 788 KB | Output is correct |
11 | Correct | 2 ms | 788 KB | Output is correct |
12 | Correct | 2 ms | 788 KB | Output is correct |
13 | Correct | 2 ms | 788 KB | Output is correct |
14 | Correct | 2 ms | 788 KB | Output is correct |
15 | Correct | 2 ms | 788 KB | Output is correct |
16 | Correct | 2 ms | 788 KB | Output is correct |
17 | Correct | 2 ms | 788 KB | Output is correct |
18 | Correct | 2 ms | 788 KB | Output is correct |
19 | Correct | 2 ms | 788 KB | Output is correct |
20 | Correct | 2 ms | 788 KB | Output is correct |
21 | Correct | 2 ms | 788 KB | Output is correct |
22 | Correct | 2 ms | 788 KB | Output is correct |
23 | Correct | 2 ms | 788 KB | Output is correct |
24 | Correct | 2 ms | 788 KB | Output is correct |
25 | Correct | 2 ms | 908 KB | Output is correct |
26 | Correct | 2 ms | 908 KB | Output is correct |
27 | Correct | 81 ms | 1288 KB | Output is correct |
28 | Correct | 30 ms | 1504 KB | Output is correct |
29 | Correct | 72 ms | 1800 KB | Output is correct |
30 | Correct | 37 ms | 1928 KB | Output is correct |
31 | Correct | 85 ms | 2148 KB | Output is correct |
32 | Correct | 31 ms | 2356 KB | Output is correct |
33 | Correct | 73 ms | 2552 KB | Output is correct |
34 | Correct | 37 ms | 2764 KB | Output is correct |
35 | Execution timed out | 2567 ms | 3216 KB | Time limit exceeded |
36 | Halted | 0 ms | 0 KB | - |