# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238433 | 2020-06-11T08:29:09 Z | Kastanda | Tenis (COI19_tenis) | C++11 | 257 ms | 7832 KB |
// Criminal #include<bits/stdc++.h> #define lc (id << 1) #define rc (lc ^ 1) #define md (l + r >> 1) using namespace std; const int N = 100005; int n, q, R[N][3], Mn[N * 4], F[N * 4], Lz[N * 4]; void Build(int id = 1, int l = 0, int r = n) { F[id] = r - 1; if (r - l > 1) Build(lc, l, md), Build(rc, md, r); } void Add(int le, int ri, int val, int id = 1, int l = 0, int r = n) { if (ri <= l || r <= le) return ; if (le <= l && r <= ri) { Lz[id] += val; Mn[id] += val; return ; } Add(le, ri, val, lc, l, md); Add(le, ri, val, rc, md, r); Mn[id] = min(Mn[lc], Mn[rc]) + Lz[id]; if (Mn[rc] <= Mn[lc]) F[id] = F[rc]; else F[id] = F[lc]; } inline void Do(int i, int val) { int l = * min_element(R[i], R[i] + 3); int r = * max_element(R[i], R[i] + 3); Add(l, r, val); } int main() { scanf("%d%d", &n, &q); for (int w = 0; w < 3; w ++) for (int i = 1, a; i <= n; i ++) scanf("%d", &a), R[a][w] = n - i + 1; Build(); for (int i = 1; i <= n; i ++) Do(i, 1); for (; q; q --) { int tp, w, a, b; scanf("%d%d", &tp, &w); if (tp == 1) puts(R[w][0] > F[1] ? "DA" : "NE"); else { scanf("%d%d", &a, &b); w --; Do(a, -1); Do(b, -1); swap(R[a][w], R[b][w]); Do(a, 1); Do(b, 1); } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 116 ms | 6296 KB | Output is correct |
14 | Correct | 90 ms | 6264 KB | Output is correct |
15 | Correct | 117 ms | 6264 KB | Output is correct |
16 | Correct | 83 ms | 6264 KB | Output is correct |
17 | Correct | 87 ms | 6264 KB | Output is correct |
18 | Correct | 80 ms | 6264 KB | Output is correct |
19 | Correct | 79 ms | 6264 KB | Output is correct |
20 | Correct | 90 ms | 6264 KB | Output is correct |
21 | Correct | 80 ms | 6264 KB | Output is correct |
22 | Correct | 110 ms | 6264 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 7416 KB | Output is correct |
2 | Correct | 111 ms | 7428 KB | Output is correct |
3 | Correct | 124 ms | 7404 KB | Output is correct |
4 | Correct | 123 ms | 7416 KB | Output is correct |
5 | Correct | 115 ms | 7364 KB | Output is correct |
6 | Correct | 109 ms | 7288 KB | Output is correct |
7 | Correct | 112 ms | 7388 KB | Output is correct |
8 | Correct | 107 ms | 7424 KB | Output is correct |
9 | Correct | 141 ms | 7416 KB | Output is correct |
10 | Correct | 129 ms | 7296 KB | Output is correct |
11 | Correct | 115 ms | 7416 KB | Output is correct |
12 | Correct | 111 ms | 7288 KB | Output is correct |
13 | Correct | 110 ms | 7416 KB | Output is correct |
14 | Correct | 136 ms | 7416 KB | Output is correct |
15 | Correct | 111 ms | 7416 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 512 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 116 ms | 6296 KB | Output is correct |
14 | Correct | 90 ms | 6264 KB | Output is correct |
15 | Correct | 117 ms | 6264 KB | Output is correct |
16 | Correct | 83 ms | 6264 KB | Output is correct |
17 | Correct | 87 ms | 6264 KB | Output is correct |
18 | Correct | 80 ms | 6264 KB | Output is correct |
19 | Correct | 79 ms | 6264 KB | Output is correct |
20 | Correct | 90 ms | 6264 KB | Output is correct |
21 | Correct | 80 ms | 6264 KB | Output is correct |
22 | Correct | 110 ms | 6264 KB | Output is correct |
23 | Correct | 110 ms | 7416 KB | Output is correct |
24 | Correct | 111 ms | 7428 KB | Output is correct |
25 | Correct | 124 ms | 7404 KB | Output is correct |
26 | Correct | 123 ms | 7416 KB | Output is correct |
27 | Correct | 115 ms | 7364 KB | Output is correct |
28 | Correct | 109 ms | 7288 KB | Output is correct |
29 | Correct | 112 ms | 7388 KB | Output is correct |
30 | Correct | 107 ms | 7424 KB | Output is correct |
31 | Correct | 141 ms | 7416 KB | Output is correct |
32 | Correct | 129 ms | 7296 KB | Output is correct |
33 | Correct | 115 ms | 7416 KB | Output is correct |
34 | Correct | 111 ms | 7288 KB | Output is correct |
35 | Correct | 110 ms | 7416 KB | Output is correct |
36 | Correct | 136 ms | 7416 KB | Output is correct |
37 | Correct | 111 ms | 7416 KB | Output is correct |
38 | Correct | 224 ms | 7804 KB | Output is correct |
39 | Correct | 131 ms | 7416 KB | Output is correct |
40 | Correct | 257 ms | 7800 KB | Output is correct |
41 | Correct | 162 ms | 7520 KB | Output is correct |
42 | Correct | 147 ms | 7544 KB | Output is correct |
43 | Correct | 228 ms | 7816 KB | Output is correct |
44 | Correct | 144 ms | 7544 KB | Output is correct |
45 | Correct | 161 ms | 7544 KB | Output is correct |
46 | Correct | 138 ms | 7544 KB | Output is correct |
47 | Correct | 163 ms | 7648 KB | Output is correct |
48 | Correct | 165 ms | 7416 KB | Output is correct |
49 | Correct | 148 ms | 7544 KB | Output is correct |
50 | Correct | 127 ms | 7416 KB | Output is correct |
51 | Correct | 161 ms | 7672 KB | Output is correct |
52 | Correct | 230 ms | 7832 KB | Output is correct |
53 | Correct | 135 ms | 7544 KB | Output is correct |
54 | Correct | 151 ms | 7544 KB | Output is correct |
55 | Correct | 154 ms | 7544 KB | Output is correct |
56 | Correct | 177 ms | 7544 KB | Output is correct |
57 | Correct | 132 ms | 7416 KB | Output is correct |
58 | Correct | 209 ms | 7544 KB | Output is correct |