Submission #22365

# Submission time Handle Problem Language Result Execution time Memory
22365 2017-04-30T04:14:42 Z AcornCkiGs14004Team(#953, gs14004, cki86201, dotorya) Window Xor (KRIII5_WX) C++11
2 / 7
359 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 + 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 179 ms 2800 KB Output is correct
5 Correct 33 ms 2800 KB Output is correct
6 Correct 173 ms 2800 KB Output is correct
7 Correct 33 ms 2800 KB Output is correct
8 Correct 176 ms 2800 KB Output is correct
9 Correct 169 ms 2800 KB Output is correct
10 Correct 189 ms 2800 KB Output is correct
11 Correct 169 ms 2800 KB Output is correct
12 Correct 56 ms 2800 KB Output is correct
13 Correct 113 ms 2800 KB Output is correct
14 Correct 106 ms 2800 KB Output is correct
15 Correct 103 ms 2800 KB Output is correct
16 Correct 173 ms 2800 KB Output is correct
17 Correct 193 ms 2800 KB Output is correct
18 Correct 103 ms 2800 KB Output is correct
19 Correct 103 ms 2800 KB Output is correct
20 Correct 126 ms 2800 KB Output is correct
21 Correct 126 ms 2800 KB Output is correct
22 Correct 126 ms 2800 KB Output is correct
23 Correct 109 ms 2800 KB Output is correct
24 Correct 113 ms 2800 KB Output is correct
25 Correct 116 ms 2800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 2800 KB Output is correct
2 Correct 86 ms 2800 KB Output is correct
3 Correct 143 ms 2800 KB Output is correct
4 Correct 186 ms 2800 KB Output is correct
5 Correct 179 ms 2800 KB Output is correct
6 Correct 109 ms 2800 KB Output is correct
7 Correct 103 ms 2800 KB Output is correct
8 Correct 169 ms 2800 KB Output is correct
9 Correct 179 ms 2800 KB Output is correct
10 Correct 103 ms 2800 KB Output is correct
11 Correct 59 ms 2800 KB Output is correct
12 Correct 66 ms 2800 KB Output is correct
13 Correct 16 ms 2800 KB Output is correct
14 Correct 16 ms 2800 KB Output is correct
15 Correct 359 ms 2800 KB Output is correct
16 Correct 26 ms 2800 KB Output is correct
17 Correct 246 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 136 ms 2800 KB Output is correct
22 Correct 36 ms 2800 KB Output is correct
23 Correct 179 ms 2800 KB Output is correct
24 Incorrect 279 ms 2800 KB Output isn't correct
25 Halted 0 ms 0 KB -