# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23509 | 2017-05-11T16:15:42 Z | 0xrgb | Window Xor (KRIII5_WX) | C++14 | 293 ms | 1996 KB |
#include <cstdio> #include <cstring> const int MAXN = 100004; typedef long long lli; int N, K; int T, G; int D[MAXN]; int A[MAXN]; bool visited[MAXN]; int gcd2(int, int); int main() { lli t, k = 1; scanf("%d %d %lld", &N, &K, &t); for (int i = 0; i < N; ++i) { scanf("%d", &A[i]); } while (t) { if (!(t & 1)) { k <<= 1; t >>= 1; continue; } T = k % N; G = gcd2(N, T); K %= 2 * (N / G); t >>= 1; k <<= 1; memcpy(D, A, sizeof(int) * N); memset(visited, 0, sizeof(bool) * N); for (int i = 0; i < N; ++i) { if (visited[i]) continue; int st = i, val = 0; for (int j = 0; j < K; ++j) { val ^= D[st]; st = (st + T) % N; } int ed = i; while(!visited[ed]) { A[ed] = val; visited[ed] = true; val ^= (D[ed] ^ D[st]); st = (st + T) % N; ed = (ed + T) % N; } } } for (int i = 0; i < N; ++i) { printf("%d ", A[i]); } puts(""); return 0; } int gcd2(int x, int y) { if (y) return gcd2(y, x % y); return x; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1996 KB | Output is correct |
2 | Correct | 0 ms | 1996 KB | Output is correct |
3 | Correct | 0 ms | 1996 KB | Output is correct |
4 | Correct | 169 ms | 1996 KB | Output is correct |
5 | Correct | 29 ms | 1996 KB | Output is correct |
6 | Correct | 166 ms | 1996 KB | Output is correct |
7 | Correct | 36 ms | 1996 KB | Output is correct |
8 | Correct | 163 ms | 1996 KB | Output is correct |
9 | Correct | 159 ms | 1996 KB | Output is correct |
10 | Correct | 183 ms | 1996 KB | Output is correct |
11 | Correct | 163 ms | 1996 KB | Output is correct |
12 | Correct | 69 ms | 1996 KB | Output is correct |
13 | Correct | 86 ms | 1996 KB | Output is correct |
14 | Correct | 83 ms | 1996 KB | Output is correct |
15 | Correct | 93 ms | 1996 KB | Output is correct |
16 | Correct | 126 ms | 1996 KB | Output is correct |
17 | Correct | 136 ms | 1996 KB | Output is correct |
18 | Correct | 79 ms | 1996 KB | Output is correct |
19 | Correct | 83 ms | 1996 KB | Output is correct |
20 | Correct | 119 ms | 1996 KB | Output is correct |
21 | Correct | 133 ms | 1996 KB | Output is correct |
22 | Correct | 109 ms | 1996 KB | Output is correct |
23 | Correct | 96 ms | 1996 KB | Output is correct |
24 | Correct | 123 ms | 1996 KB | Output is correct |
25 | Correct | 106 ms | 1996 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 173 ms | 1996 KB | Output is correct |
2 | Correct | 79 ms | 1996 KB | Output is correct |
3 | Correct | 123 ms | 1996 KB | Output is correct |
4 | Correct | 166 ms | 1996 KB | Output is correct |
5 | Correct | 163 ms | 1996 KB | Output is correct |
6 | Correct | 99 ms | 1996 KB | Output is correct |
7 | Correct | 109 ms | 1996 KB | Output is correct |
8 | Correct | 169 ms | 1996 KB | Output is correct |
9 | Correct | 173 ms | 1996 KB | Output is correct |
10 | Correct | 79 ms | 1996 KB | Output is correct |
11 | Correct | 59 ms | 1996 KB | Output is correct |
12 | Correct | 46 ms | 1996 KB | Output is correct |
13 | Correct | 9 ms | 1996 KB | Output is correct |
14 | Correct | 9 ms | 1996 KB | Output is correct |
15 | Correct | 286 ms | 1996 KB | Output is correct |
16 | Correct | 19 ms | 1996 KB | Output is correct |
17 | Correct | 219 ms | 1996 KB | Output is correct |
18 | Correct | 23 ms | 1996 KB | Output is correct |
19 | Correct | 166 ms | 1996 KB | Output is correct |
20 | Correct | 16 ms | 1996 KB | Output is correct |
21 | Correct | 133 ms | 1996 KB | Output is correct |
22 | Correct | 26 ms | 1996 KB | Output is correct |
23 | Correct | 183 ms | 1996 KB | Output is correct |
24 | Correct | 239 ms | 1996 KB | Output is correct |
25 | Correct | 9 ms | 1996 KB | Output is correct |
26 | Correct | 166 ms | 1996 KB | Output is correct |
27 | Correct | 13 ms | 1996 KB | Output is correct |
28 | Correct | 173 ms | 1996 KB | Output is correct |
29 | Correct | 9 ms | 1996 KB | Output is correct |
30 | Correct | 163 ms | 1996 KB | Output is correct |
31 | Correct | 16 ms | 1996 KB | Output is correct |
32 | Correct | 183 ms | 1996 KB | Output is correct |
33 | Correct | 19 ms | 1996 KB | Output is correct |
34 | Correct | 246 ms | 1996 KB | Output is correct |
35 | Correct | 259 ms | 1996 KB | Output is correct |
36 | Correct | 293 ms | 1996 KB | Output is correct |
37 | Correct | 293 ms | 1996 KB | Output is correct |
38 | Correct | 273 ms | 1996 KB | Output is correct |
39 | Correct | 236 ms | 1996 KB | Output is correct |
40 | Correct | 196 ms | 1996 KB | Output is correct |
41 | Correct | 139 ms | 1996 KB | Output is correct |
42 | Correct | 276 ms | 1996 KB | Output is correct |
43 | Correct | 179 ms | 1996 KB | Output is correct |
44 | Correct | 139 ms | 1996 KB | Output is correct |
45 | Correct | 103 ms | 1996 KB | Output is correct |
46 | Correct | 136 ms | 1996 KB | Output is correct |
47 | Correct | 156 ms | 1996 KB | Output is correct |
48 | Correct | 159 ms | 1996 KB | Output is correct |
49 | Correct | 83 ms | 1996 KB | Output is correct |
50 | Correct | 116 ms | 1996 KB | Output is correct |
51 | Correct | 139 ms | 1996 KB | Output is correct |
52 | Correct | 153 ms | 1996 KB | Output is correct |
53 | Correct | 173 ms | 1996 KB | Output is correct |
54 | Correct | 76 ms | 1996 KB | Output is correct |
55 | Correct | 93 ms | 1996 KB | Output is correct |
56 | Correct | 36 ms | 1996 KB | Output is correct |
57 | Correct | 76 ms | 1996 KB | Output is correct |
58 | Correct | 103 ms | 1996 KB | Output is correct |
59 | Correct | 93 ms | 1996 KB | Output is correct |
60 | Correct | 143 ms | 1996 KB | Output is correct |
61 | Correct | 149 ms | 1996 KB | Output is correct |
62 | Correct | 159 ms | 1996 KB | Output is correct |
63 | Correct | 96 ms | 1996 KB | Output is correct |
64 | Correct | 143 ms | 1996 KB | Output is correct |
65 | Correct | 56 ms | 1996 KB | Output is correct |
66 | Correct | 113 ms | 1996 KB | Output is correct |
67 | Correct | 189 ms | 1996 KB | Output is correct |
68 | Correct | 139 ms | 1996 KB | Output is correct |
69 | Correct | 133 ms | 1996 KB | Output is correct |
70 | Correct | 129 ms | 1996 KB | Output is correct |
71 | Correct | 166 ms | 1996 KB | Output is correct |
72 | Correct | 146 ms | 1996 KB | Output is correct |
73 | Correct | 126 ms | 1996 KB | Output is correct |
74 | Correct | 153 ms | 1996 KB | Output is correct |
75 | Correct | 176 ms | 1996 KB | Output is correct |
76 | Correct | 0 ms | 1996 KB | Output is correct |
77 | Correct | 0 ms | 1996 KB | Output is correct |
78 | Correct | 0 ms | 1996 KB | Output is correct |
79 | Correct | 169 ms | 1996 KB | Output is correct |
80 | Correct | 29 ms | 1996 KB | Output is correct |
81 | Correct | 166 ms | 1996 KB | Output is correct |
82 | Correct | 36 ms | 1996 KB | Output is correct |
83 | Correct | 163 ms | 1996 KB | Output is correct |
84 | Correct | 159 ms | 1996 KB | Output is correct |
85 | Correct | 183 ms | 1996 KB | Output is correct |
86 | Correct | 163 ms | 1996 KB | Output is correct |
87 | Correct | 69 ms | 1996 KB | Output is correct |
88 | Correct | 86 ms | 1996 KB | Output is correct |
89 | Correct | 83 ms | 1996 KB | Output is correct |
90 | Correct | 93 ms | 1996 KB | Output is correct |
91 | Correct | 126 ms | 1996 KB | Output is correct |
92 | Correct | 136 ms | 1996 KB | Output is correct |
93 | Correct | 79 ms | 1996 KB | Output is correct |
94 | Correct | 83 ms | 1996 KB | Output is correct |
95 | Correct | 119 ms | 1996 KB | Output is correct |
96 | Correct | 133 ms | 1996 KB | Output is correct |
97 | Correct | 109 ms | 1996 KB | Output is correct |
98 | Correct | 96 ms | 1996 KB | Output is correct |
99 | Correct | 123 ms | 1996 KB | Output is correct |
100 | Correct | 106 ms | 1996 KB | Output is correct |