Submission #22369

# Submission time Handle Problem Language Result Execution time Memory
22369 2017-04-30T04:15:32 Z AcornCkiGs14004Team(#953, gs14004, cki86201, dotorya) Window Xor (KRIII5_WX) C++11
7 / 7
376 ms 2800 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int N, K;
int Y[100010];
int Z[100010];

int gc(int x, int y){return y == 0 ? x : gc(y, x % y); }

void Do(int x){
	int g = gc(x, N);
	for(int q=0;q<g;q++){
		int tk = K % (2 * N / g);
		int C = 0;
		for(int i=0;i<tk;i++){
			int t = (ll)(q + (ll)i * x) % N;
			C ^= Y[t];
		}
		Z[q] = C;
		for(int i=(x+q)%N;i!=q;i=(i+x)%N){
			Z[i] = Z[(i+N-x)%N];
			Z[i] ^= Y[(i+N-x)%N];
			Z[i] ^= Y[(i+N-x+(ll)tk*x) % N];
		}
	}
	rep(i, N)Y[i] = Z[i], Z[i] = 0;
}

void solve(int tc){
	scanf("%d%d", &N, &K);
	ll T; scanf("%lld", &T);
	for(int i=0;i<N;i++)scanf("%d", Y+i);
	int tmp = 1;
	while(T){
		if(T & 1){
			Do(tmp);
		}
		tmp = (tmp + tmp) % N;
		T >>= 1;
	}
	for(int i=0;i<N;i++)printf("%d ", Y[i]); puts("");
}

int main(){
	int Tc = 1; //scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}

Compilation message

WX.cpp: In function 'void solve(int)':
WX.cpp:51:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &K);
                       ^
WX.cpp:52:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  ll T; scanf("%lld", &T);
                         ^
WX.cpp:53:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<N;i++)scanf("%d", Y+i);
                                      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2800 KB Output is correct
2 Correct 0 ms 2800 KB Output is correct
3 Correct 0 ms 2800 KB Output is correct
4 Correct 203 ms 2800 KB Output is correct
5 Correct 29 ms 2800 KB Output is correct
6 Correct 166 ms 2800 KB Output is correct
7 Correct 29 ms 2800 KB Output is correct
8 Correct 186 ms 2800 KB Output is correct
9 Correct 169 ms 2800 KB Output is correct
10 Correct 173 ms 2800 KB Output is correct
11 Correct 173 ms 2800 KB Output is correct
12 Correct 69 ms 2800 KB Output is correct
13 Correct 106 ms 2800 KB Output is correct
14 Correct 103 ms 2800 KB Output is correct
15 Correct 109 ms 2800 KB Output is correct
16 Correct 176 ms 2800 KB Output is correct
17 Correct 186 ms 2800 KB Output is correct
18 Correct 96 ms 2800 KB Output is correct
19 Correct 99 ms 2800 KB Output is correct
20 Correct 143 ms 2800 KB Output is correct
21 Correct 136 ms 2800 KB Output is correct
22 Correct 146 ms 2800 KB Output is correct
23 Correct 119 ms 2800 KB Output is correct
24 Correct 126 ms 2800 KB Output is correct
25 Correct 119 ms 2800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 173 ms 2800 KB Output is correct
2 Correct 83 ms 2800 KB Output is correct
3 Correct 163 ms 2800 KB Output is correct
4 Correct 199 ms 2800 KB Output is correct
5 Correct 173 ms 2800 KB Output is correct
6 Correct 93 ms 2800 KB Output is correct
7 Correct 99 ms 2800 KB Output is correct
8 Correct 169 ms 2800 KB Output is correct
9 Correct 176 ms 2800 KB Output is correct
10 Correct 99 ms 2800 KB Output is correct
11 Correct 63 ms 2800 KB Output is correct
12 Correct 63 ms 2800 KB Output is correct
13 Correct 13 ms 2800 KB Output is correct
14 Correct 16 ms 2800 KB Output is correct
15 Correct 329 ms 2800 KB Output is correct
16 Correct 26 ms 2800 KB Output is correct
17 Correct 243 ms 2800 KB Output is correct
18 Correct 26 ms 2800 KB Output is correct
19 Correct 176 ms 2800 KB Output is correct
20 Correct 19 ms 2800 KB Output is correct
21 Correct 143 ms 2800 KB Output is correct
22 Correct 26 ms 2800 KB Output is correct
23 Correct 173 ms 2800 KB Output is correct
24 Correct 253 ms 2800 KB Output is correct
25 Correct 16 ms 2800 KB Output is correct
26 Correct 173 ms 2800 KB Output is correct
27 Correct 13 ms 2800 KB Output is correct
28 Correct 176 ms 2800 KB Output is correct
29 Correct 19 ms 2800 KB Output is correct
30 Correct 193 ms 2800 KB Output is correct
31 Correct 19 ms 2800 KB Output is correct
32 Correct 196 ms 2800 KB Output is correct
33 Correct 23 ms 2800 KB Output is correct
34 Correct 256 ms 2800 KB Output is correct
35 Correct 303 ms 2800 KB Output is correct
36 Correct 316 ms 2800 KB Output is correct
37 Correct 319 ms 2800 KB Output is correct
38 Correct 326 ms 2800 KB Output is correct
39 Correct 316 ms 2800 KB Output is correct
40 Correct 279 ms 2800 KB Output is correct
41 Correct 143 ms 2800 KB Output is correct
42 Correct 376 ms 2800 KB Output is correct
43 Correct 196 ms 2800 KB Output is correct
44 Correct 209 ms 2800 KB Output is correct
45 Correct 149 ms 2800 KB Output is correct
46 Correct 193 ms 2800 KB Output is correct
47 Correct 216 ms 2800 KB Output is correct
48 Correct 186 ms 2800 KB Output is correct
49 Correct 106 ms 2800 KB Output is correct
50 Correct 149 ms 2800 KB Output is correct
51 Correct 186 ms 2800 KB Output is correct
52 Correct 199 ms 2800 KB Output is correct
53 Correct 229 ms 2800 KB Output is correct
54 Correct 69 ms 2800 KB Output is correct
55 Correct 109 ms 2800 KB Output is correct
56 Correct 43 ms 2800 KB Output is correct
57 Correct 69 ms 2800 KB Output is correct
58 Correct 123 ms 2800 KB Output is correct
59 Correct 113 ms 2800 KB Output is correct
60 Correct 179 ms 2800 KB Output is correct
61 Correct 186 ms 2800 KB Output is correct
62 Correct 183 ms 2800 KB Output is correct
63 Correct 106 ms 2800 KB Output is correct
64 Correct 173 ms 2800 KB Output is correct
65 Correct 76 ms 2800 KB Output is correct
66 Correct 109 ms 2800 KB Output is correct
67 Correct 196 ms 2800 KB Output is correct
68 Correct 163 ms 2800 KB Output is correct
69 Correct 123 ms 2800 KB Output is correct
70 Correct 159 ms 2800 KB Output is correct
71 Correct 186 ms 2800 KB Output is correct
72 Correct 173 ms 2800 KB Output is correct
73 Correct 126 ms 2800 KB Output is correct
74 Correct 153 ms 2800 KB Output is correct
75 Correct 196 ms 2800 KB Output is correct
76 Correct 0 ms 2800 KB Output is correct
77 Correct 0 ms 2800 KB Output is correct
78 Correct 0 ms 2800 KB Output is correct
79 Correct 203 ms 2800 KB Output is correct
80 Correct 29 ms 2800 KB Output is correct
81 Correct 166 ms 2800 KB Output is correct
82 Correct 29 ms 2800 KB Output is correct
83 Correct 186 ms 2800 KB Output is correct
84 Correct 169 ms 2800 KB Output is correct
85 Correct 173 ms 2800 KB Output is correct
86 Correct 173 ms 2800 KB Output is correct
87 Correct 69 ms 2800 KB Output is correct
88 Correct 106 ms 2800 KB Output is correct
89 Correct 103 ms 2800 KB Output is correct
90 Correct 109 ms 2800 KB Output is correct
91 Correct 176 ms 2800 KB Output is correct
92 Correct 186 ms 2800 KB Output is correct
93 Correct 96 ms 2800 KB Output is correct
94 Correct 99 ms 2800 KB Output is correct
95 Correct 143 ms 2800 KB Output is correct
96 Correct 136 ms 2800 KB Output is correct
97 Correct 146 ms 2800 KB Output is correct
98 Correct 119 ms 2800 KB Output is correct
99 Correct 126 ms 2800 KB Output is correct
100 Correct 119 ms 2800 KB Output is correct