# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
58380 | 2018-07-17T15:54:27 Z | 3zp | Xylophone (JOI18_xylophone) | C++14 | 134 ms | 972 KB |
#include "xylophone.h" #include<bits/stdc++.h> using namespace std; int A[5009],B[5009],C[5009]; void solve(int N) { int M = 1, t = 1; for(int i = 2; i <= N; i++) A[i] = query(i-1,i); for(int i = 3; i <= N; i++) B[i] = query(i-2,i); C[2] = 1; for(int i = 3; i <= N; i++){ if(B[i] == A[i] + A[i-1]) C[i] = C[i-1]; else C[i] = 1- C[i-1]; } B[1] = 0; int X = 0; for(int i = 2; i <= N; i++){ if(C[i]) B[i] = A[i] + B[i-1]; else B[i] = -A[i] + B[i-1]; X = min(X,B[i]); } int a = 0, b = 0; for(int i = 1; i <= N; i++){ B[i] -= X-1; if(B[i] == 1) a = i; if(B[i] == N) b = i; } if(a > b) for(int i = 1; i <= N; i++) B[i] = N + 1 - B[i]; for(int i = 1; i <= N; i++) answer(i, B[i]); //i i-2 i-1 }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 4 ms | 516 KB | Output is correct |
5 | Correct | 6 ms | 516 KB | Output is correct |
6 | Correct | 5 ms | 628 KB | Output is correct |
7 | Correct | 4 ms | 628 KB | Output is correct |
8 | Correct | 5 ms | 628 KB | Output is correct |
9 | Correct | 6 ms | 628 KB | Output is correct |
10 | Correct | 4 ms | 628 KB | Output is correct |
11 | Correct | 4 ms | 628 KB | Output is correct |
12 | Correct | 4 ms | 628 KB | Output is correct |
13 | Correct | 3 ms | 628 KB | Output is correct |
14 | Correct | 7 ms | 628 KB | Output is correct |
15 | Correct | 5 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 4 ms | 516 KB | Output is correct |
5 | Correct | 6 ms | 516 KB | Output is correct |
6 | Correct | 5 ms | 628 KB | Output is correct |
7 | Correct | 4 ms | 628 KB | Output is correct |
8 | Correct | 5 ms | 628 KB | Output is correct |
9 | Correct | 6 ms | 628 KB | Output is correct |
10 | Correct | 4 ms | 628 KB | Output is correct |
11 | Correct | 4 ms | 628 KB | Output is correct |
12 | Correct | 4 ms | 628 KB | Output is correct |
13 | Correct | 3 ms | 628 KB | Output is correct |
14 | Correct | 7 ms | 628 KB | Output is correct |
15 | Correct | 5 ms | 628 KB | Output is correct |
16 | Correct | 6 ms | 628 KB | Output is correct |
17 | Correct | 9 ms | 628 KB | Output is correct |
18 | Correct | 18 ms | 628 KB | Output is correct |
19 | Correct | 20 ms | 628 KB | Output is correct |
20 | Correct | 24 ms | 680 KB | Output is correct |
21 | Correct | 33 ms | 716 KB | Output is correct |
22 | Correct | 21 ms | 716 KB | Output is correct |
23 | Correct | 20 ms | 716 KB | Output is correct |
24 | Correct | 33 ms | 716 KB | Output is correct |
25 | Correct | 11 ms | 716 KB | Output is correct |
26 | Correct | 20 ms | 716 KB | Output is correct |
27 | Correct | 18 ms | 716 KB | Output is correct |
28 | Correct | 13 ms | 716 KB | Output is correct |
29 | Correct | 24 ms | 716 KB | Output is correct |
30 | Correct | 18 ms | 716 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 476 KB | Output is correct |
3 | Correct | 3 ms | 476 KB | Output is correct |
4 | Correct | 4 ms | 516 KB | Output is correct |
5 | Correct | 6 ms | 516 KB | Output is correct |
6 | Correct | 5 ms | 628 KB | Output is correct |
7 | Correct | 4 ms | 628 KB | Output is correct |
8 | Correct | 5 ms | 628 KB | Output is correct |
9 | Correct | 6 ms | 628 KB | Output is correct |
10 | Correct | 4 ms | 628 KB | Output is correct |
11 | Correct | 4 ms | 628 KB | Output is correct |
12 | Correct | 4 ms | 628 KB | Output is correct |
13 | Correct | 3 ms | 628 KB | Output is correct |
14 | Correct | 7 ms | 628 KB | Output is correct |
15 | Correct | 5 ms | 628 KB | Output is correct |
16 | Correct | 6 ms | 628 KB | Output is correct |
17 | Correct | 9 ms | 628 KB | Output is correct |
18 | Correct | 18 ms | 628 KB | Output is correct |
19 | Correct | 20 ms | 628 KB | Output is correct |
20 | Correct | 24 ms | 680 KB | Output is correct |
21 | Correct | 33 ms | 716 KB | Output is correct |
22 | Correct | 21 ms | 716 KB | Output is correct |
23 | Correct | 20 ms | 716 KB | Output is correct |
24 | Correct | 33 ms | 716 KB | Output is correct |
25 | Correct | 11 ms | 716 KB | Output is correct |
26 | Correct | 20 ms | 716 KB | Output is correct |
27 | Correct | 18 ms | 716 KB | Output is correct |
28 | Correct | 13 ms | 716 KB | Output is correct |
29 | Correct | 24 ms | 716 KB | Output is correct |
30 | Correct | 18 ms | 716 KB | Output is correct |
31 | Correct | 43 ms | 716 KB | Output is correct |
32 | Correct | 34 ms | 716 KB | Output is correct |
33 | Correct | 83 ms | 716 KB | Output is correct |
34 | Correct | 91 ms | 716 KB | Output is correct |
35 | Correct | 99 ms | 716 KB | Output is correct |
36 | Correct | 53 ms | 716 KB | Output is correct |
37 | Correct | 89 ms | 716 KB | Output is correct |
38 | Correct | 92 ms | 716 KB | Output is correct |
39 | Correct | 114 ms | 716 KB | Output is correct |
40 | Correct | 98 ms | 716 KB | Output is correct |
41 | Correct | 134 ms | 716 KB | Output is correct |
42 | Correct | 98 ms | 716 KB | Output is correct |
43 | Correct | 96 ms | 716 KB | Output is correct |
44 | Correct | 96 ms | 972 KB | Output is correct |
45 | Correct | 72 ms | 972 KB | Output is correct |
46 | Correct | 94 ms | 972 KB | Output is correct |
47 | Correct | 113 ms | 972 KB | Output is correct |
48 | Correct | 103 ms | 972 KB | Output is correct |
49 | Correct | 85 ms | 972 KB | Output is correct |
50 | Correct | 93 ms | 972 KB | Output is correct |
51 | Correct | 93 ms | 972 KB | Output is correct |
52 | Correct | 87 ms | 972 KB | Output is correct |
53 | Correct | 111 ms | 972 KB | Output is correct |
54 | Correct | 111 ms | 972 KB | Output is correct |
55 | Correct | 104 ms | 972 KB | Output is correct |
56 | Correct | 129 ms | 972 KB | Output is correct |
57 | Correct | 113 ms | 972 KB | Output is correct |
58 | Correct | 102 ms | 972 KB | Output is correct |
59 | Correct | 80 ms | 972 KB | Output is correct |
60 | Correct | 54 ms | 972 KB | Output is correct |