Submission #22627

# Submission time Handle Problem Language Result Execution time Memory
22627 2017-04-30T06:00:22 Z 팀명을 한번 정하면 못바꿀까?(#898, qja0950) Window Xor (KRIII5_WX) C++14
2 / 7
1000 ms 2716 KB
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <string.h>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long ll;
typedef pair<int, int> pi;

const int MAX_N = 1e5 + 10, LOG_T = 70;

int N, K; ll T;
int main() {
	scanf("%d%d%lld", &N, &K, &T);
//	T = 1e18; N = 1e5, K = N - 10;
	vector<int> Nr; Nr = vector<int>(N, 0);
	vector<int> next; next = vector<int>(N, 0);
	vector<bool> chk; chk = vector<bool>(N, false);
	for(int i=0; i<N; i++) scanf("%d", &Nr[i]);

	int p2 = 1;
	while(T) {
		if(T%2) {
			for(int i=0; i<N; i++) chk[i] = false;
			for(int s=0; s<N; s++) {
				if(chk[s] == true) continue;
				int l = s, r = (1ll * p2 * (K-1) + s) % N;
				next[s] = 0;
				if(l == ((l + p2) % N)) {
					next[s] = ((K % 2) ? Nr[s] : 0);
					chk[s] = true;
					continue;
				}
				for(int i=0, ll = l; i<K; i++, ll = (ll + p2) % N) next[s] ^= Nr[ll]; chk[s] = true;
				while(1) {
					int nl = (l+p2) % N, nr = (r+p2) % N;
					if(chk[nl] == true) break;
					next[nl] = next[l] ^ Nr[l] ^ Nr[nr];
					chk[nl] = true;
					l = nl; r = nr;
				}
			}
			Nr = next;
		}
		p2 *= 2; p2 %= N;
		T/=2;
	}
	for(int i=0; i<N; i++) printf("%d ", Nr[i]);
	return 0;
}

Compilation message

WX.cpp: In function 'int main()':
WX.cpp:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%lld", &N, &K, &T);
                               ^
WX.cpp:26:44: 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", &Nr[i]);
                                            ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1932 KB Output is correct
2 Correct 0 ms 1932 KB Output is correct
3 Correct 0 ms 1932 KB Output is correct
4 Correct 143 ms 2716 KB Output is correct
5 Correct 33 ms 2716 KB Output is correct
6 Correct 146 ms 2716 KB Output is correct
7 Correct 29 ms 2716 KB Output is correct
8 Correct 136 ms 2716 KB Output is correct
9 Correct 136 ms 2716 KB Output is correct
10 Correct 146 ms 2716 KB Output is correct
11 Correct 139 ms 2716 KB Output is correct
12 Correct 66 ms 2452 KB Output is correct
13 Correct 66 ms 2452 KB Output is correct
14 Correct 93 ms 2452 KB Output is correct
15 Correct 96 ms 2452 KB Output is correct
16 Correct 146 ms 2708 KB Output is correct
17 Correct 166 ms 2708 KB Output is correct
18 Correct 89 ms 2412 KB Output is correct
19 Correct 89 ms 2412 KB Output is correct
20 Correct 106 ms 2716 KB Output is correct
21 Correct 103 ms 2716 KB Output is correct
22 Correct 99 ms 2716 KB Output is correct
23 Correct 89 ms 2716 KB Output is correct
24 Correct 96 ms 2716 KB Output is correct
25 Correct 99 ms 2716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 139 ms 2716 KB Output is correct
2 Correct 69 ms 2716 KB Output is correct
3 Correct 106 ms 2716 KB Output is correct
4 Correct 156 ms 2716 KB Output is correct
5 Correct 139 ms 2716 KB Output is correct
6 Correct 76 ms 2716 KB Output is correct
7 Correct 86 ms 2716 KB Output is correct
8 Correct 139 ms 2708 KB Output is correct
9 Correct 136 ms 2708 KB Output is correct
10 Correct 63 ms 2452 KB Output is correct
11 Correct 49 ms 2452 KB Output is correct
12 Correct 53 ms 2452 KB Output is correct
13 Correct 13 ms 2088 KB Output is correct
14 Correct 13 ms 2088 KB Output is correct
15 Correct 249 ms 2716 KB Output is correct
16 Correct 33 ms 2088 KB Output is correct
17 Correct 873 ms 2716 KB Output is correct
18 Correct 63 ms 2088 KB Output is correct
19 Execution timed out 1000 ms 2716 KB Execution timed out
20 Halted 0 ms 0 KB -