# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22938 | 2017-04-30T14:59:16 Z | dotorya | Window Xor (KRIII5_WX) | C++14 | 359 ms | 5312 KB |
#include <stdio.h> #include <algorithm> #include <assert.h> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #pragma warning(disable:4996) #pragma comment(linker, "/STACK:336777216") using namespace std; #define mp make_pair #define Fi first #define Se second #define pb(x) push_back(x) #define szz(x) ((int)(x).size()) #define rep(i, n) for(int i=0;i<n;i++) #define all(x) (x).begin(), (x).end() #define ldb ldouble typedef tuple<int, int, int> t3; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef pair <ll, int> pli; typedef pair <db, db> pdd; int IT_MAX = 1 << 19; const ll MOD = 1000000007; const int INF = 0x3f3f3f3f; const ll LL_INF = 1034567890123456789ll; const db PI = acos(-1); const db ERR = 1E-11; ll mypow(ll a, ll b, ll g = MOD) { ll rv = 1 % g; while (b) { if (b % 2) rv = (rv * a) % g; a = (a*a) % g; b /= 2; } return rv; } ll in[100050]; ll tin[100050]; bool dchk[100050]; vector <int> Vu; ll sum[100050]; ll getsum(ll x) { ll t1 = x / Vu.size(); ll t2 = x % Vu.size(); ll rv = 0; if (t1 % 2) rv = sum[Vu.size() - 1]; rv ^= sum[t2]; return rv; } void dodo(int N, int K, ll x) { x = mypow(2, x, N); int i, j; for (i = 0; i < N; i++) dchk[i] = false; for (i = 0; i < N; i++) { if (dchk[i]) continue; ll t = i; while (!dchk[t]) { Vu.push_back(t); dchk[t] = true; t = (t + x) % N; } sum[0] = in[Vu[0]]; for (j = 1; j < Vu.size(); j++) sum[j] = sum[j - 1] ^ in[Vu[j]]; for (j = 0; j < Vu.size(); j++) { tin[Vu[j]] = getsum(j + K - 1); if (j) tin[Vu[j]] ^= getsum(j - 1); } Vu.clear(); } for (i = 0; i < N; i++) in[i] = tin[i]; } int main() { int N, K, i; ll T; scanf("%d %d %lld", &N, &K, &T); for (i = 0; i < N; i++) scanf("%lld", &in[i]); for (i = 61; i >= 0; i--) if (T & (1ll << i)) dodo(N, K, i); for (i = 0; i < N; i++) printf("%lld ", in[i]); return !printf("\n"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 4460 KB | Output is correct |
2 | Correct | 0 ms | 4460 KB | Output is correct |
3 | Correct | 0 ms | 4460 KB | Output is correct |
4 | Correct | 359 ms | 5312 KB | Output is correct |
5 | Correct | 33 ms | 5312 KB | Output is correct |
6 | Correct | 316 ms | 5312 KB | Output is correct |
7 | Correct | 33 ms | 5312 KB | Output is correct |
8 | Correct | 306 ms | 5312 KB | Output is correct |
9 | Correct | 313 ms | 5312 KB | Output is correct |
10 | Correct | 306 ms | 5312 KB | Output is correct |
11 | Correct | 319 ms | 5312 KB | Output is correct |
12 | Correct | 153 ms | 4928 KB | Output is correct |
13 | Correct | 153 ms | 4928 KB | Output is correct |
14 | Correct | 223 ms | 4928 KB | Output is correct |
15 | Correct | 199 ms | 4928 KB | Output is correct |
16 | Correct | 276 ms | 5312 KB | Output is correct |
17 | Correct | 266 ms | 5312 KB | Output is correct |
18 | Correct | 199 ms | 4928 KB | Output is correct |
19 | Correct | 219 ms | 4928 KB | Output is correct |
20 | Correct | 239 ms | 5312 KB | Output is correct |
21 | Correct | 216 ms | 5312 KB | Output is correct |
22 | Correct | 229 ms | 5312 KB | Output is correct |
23 | Correct | 196 ms | 5312 KB | Output is correct |
24 | Correct | 199 ms | 5312 KB | Output is correct |
25 | Correct | 203 ms | 5312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 306 ms | 5312 KB | Output is correct |
2 | Correct | 143 ms | 4460 KB | Output is correct |
3 | Correct | 243 ms | 5312 KB | Output is correct |
4 | Correct | 303 ms | 5312 KB | Output is correct |
5 | Correct | 326 ms | 5312 KB | Output is correct |
6 | Correct | 166 ms | 5312 KB | Output is correct |
7 | Correct | 166 ms | 5312 KB | Output is correct |
8 | Correct | 329 ms | 5312 KB | Output is correct |
9 | Correct | 329 ms | 5312 KB | Output is correct |
10 | Correct | 156 ms | 4928 KB | Output is correct |
11 | Correct | 106 ms | 4928 KB | Output is correct |
12 | Correct | 109 ms | 4928 KB | Output is correct |
13 | Correct | 26 ms | 4600 KB | Output is correct |
14 | Correct | 33 ms | 4600 KB | Output is correct |
15 | Correct | 326 ms | 5312 KB | Output is correct |
16 | Correct | 29 ms | 4600 KB | Output is correct |
17 | Correct | 316 ms | 5312 KB | Output is correct |
18 | Correct | 29 ms | 4600 KB | Output is correct |
19 | Correct | 316 ms | 5312 KB | Output is correct |
20 | Correct | 39 ms | 4600 KB | Output is correct |
21 | Correct | 173 ms | 5312 KB | Output is correct |
22 | Correct | 29 ms | 4600 KB | Output is correct |
23 | Correct | 319 ms | 5312 KB | Output is correct |
24 | Correct | 323 ms | 5312 KB | Output is correct |
25 | Correct | 29 ms | 4600 KB | Output is correct |
26 | Correct | 306 ms | 5312 KB | Output is correct |
27 | Correct | 29 ms | 4600 KB | Output is correct |
28 | Correct | 326 ms | 5312 KB | Output is correct |
29 | Correct | 39 ms | 4600 KB | Output is correct |
30 | Correct | 336 ms | 5312 KB | Output is correct |
31 | Correct | 29 ms | 4600 KB | Output is correct |
32 | Correct | 319 ms | 5312 KB | Output is correct |
33 | Correct | 29 ms | 4600 KB | Output is correct |
34 | Correct | 326 ms | 5312 KB | Output is correct |
35 | Correct | 353 ms | 5312 KB | Output is correct |
36 | Correct | 329 ms | 5312 KB | Output is correct |
37 | Correct | 326 ms | 5312 KB | Output is correct |
38 | Correct | 316 ms | 5312 KB | Output is correct |
39 | Correct | 323 ms | 5312 KB | Output is correct |
40 | Correct | 329 ms | 5312 KB | Output is correct |
41 | Correct | 146 ms | 5312 KB | Output is correct |
42 | Correct | 326 ms | 5312 KB | Output is correct |
43 | Correct | 313 ms | 5312 KB | Output is correct |
44 | Correct | 263 ms | 5312 KB | Output is correct |
45 | Correct | 279 ms | 5312 KB | Output is correct |
46 | Correct | 269 ms | 5312 KB | Output is correct |
47 | Correct | 279 ms | 5312 KB | Output is correct |
48 | Correct | 283 ms | 5312 KB | Output is correct |
49 | Correct | 159 ms | 5312 KB | Output is correct |
50 | Correct | 266 ms | 5312 KB | Output is correct |
51 | Correct | 279 ms | 5312 KB | Output is correct |
52 | Correct | 263 ms | 5312 KB | Output is correct |
53 | Correct | 256 ms | 5312 KB | Output is correct |
54 | Correct | 149 ms | 4928 KB | Output is correct |
55 | Correct | 153 ms | 4928 KB | Output is correct |
56 | Correct | 79 ms | 4928 KB | Output is correct |
57 | Correct | 153 ms | 4928 KB | Output is correct |
58 | Correct | 156 ms | 4928 KB | Output is correct |
59 | Correct | 189 ms | 4928 KB | Output is correct |
60 | Correct | 189 ms | 4928 KB | Output is correct |
61 | Correct | 193 ms | 4928 KB | Output is correct |
62 | Correct | 196 ms | 4928 KB | Output is correct |
63 | Correct | 186 ms | 4928 KB | Output is correct |
64 | Correct | 193 ms | 4928 KB | Output is correct |
65 | Correct | 109 ms | 4928 KB | Output is correct |
66 | Correct | 143 ms | 5312 KB | Output is correct |
67 | Correct | 249 ms | 5312 KB | Output is correct |
68 | Correct | 246 ms | 5312 KB | Output is correct |
69 | Correct | 223 ms | 5312 KB | Output is correct |
70 | Correct | 216 ms | 5312 KB | Output is correct |
71 | Correct | 236 ms | 5312 KB | Output is correct |
72 | Correct | 216 ms | 5312 KB | Output is correct |
73 | Correct | 216 ms | 5312 KB | Output is correct |
74 | Correct | 226 ms | 5312 KB | Output is correct |
75 | Correct | 233 ms | 5312 KB | Output is correct |
76 | Correct | 0 ms | 4460 KB | Output is correct |
77 | Correct | 0 ms | 4460 KB | Output is correct |
78 | Correct | 0 ms | 4460 KB | Output is correct |
79 | Correct | 359 ms | 5312 KB | Output is correct |
80 | Correct | 33 ms | 5312 KB | Output is correct |
81 | Correct | 316 ms | 5312 KB | Output is correct |
82 | Correct | 33 ms | 5312 KB | Output is correct |
83 | Correct | 306 ms | 5312 KB | Output is correct |
84 | Correct | 313 ms | 5312 KB | Output is correct |
85 | Correct | 306 ms | 5312 KB | Output is correct |
86 | Correct | 319 ms | 5312 KB | Output is correct |
87 | Correct | 153 ms | 4928 KB | Output is correct |
88 | Correct | 153 ms | 4928 KB | Output is correct |
89 | Correct | 223 ms | 4928 KB | Output is correct |
90 | Correct | 199 ms | 4928 KB | Output is correct |
91 | Correct | 276 ms | 5312 KB | Output is correct |
92 | Correct | 266 ms | 5312 KB | Output is correct |
93 | Correct | 199 ms | 4928 KB | Output is correct |
94 | Correct | 219 ms | 4928 KB | Output is correct |
95 | Correct | 239 ms | 5312 KB | Output is correct |
96 | Correct | 216 ms | 5312 KB | Output is correct |
97 | Correct | 229 ms | 5312 KB | Output is correct |
98 | Correct | 196 ms | 5312 KB | Output is correct |
99 | Correct | 199 ms | 5312 KB | Output is correct |
100 | Correct | 203 ms | 5312 KB | Output is correct |