Submission #22639

# Submission time Handle Problem Language Result Execution time Memory
22639 2017-04-30T06:04:41 Z 팀명을 한번 정하면 못바꿀까?(#898, qja0950) Window Xor (KRIII5_WX) C++14
7 / 7
256 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;
				for(int i=0, ll = l; i<K; i++, ll = (ll + p2) % N) {
					if(i != 0 && ll == l) {
						if((K / i) % 2 == 0) next[s] = 0;
						for(int j=0, ll=l; j<K%i; j++, ll = (ll + p2) % N)
							next[s] ^= Nr[ll];
						break;
					}
					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 26 ms 2716 KB Output is correct
6 Correct 139 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 159 ms 2716 KB Output is correct
10 Correct 123 ms 2716 KB Output is correct
11 Correct 136 ms 2716 KB Output is correct
12 Correct 153 ms 2452 KB Output is correct
13 Correct 166 ms 2452 KB Output is correct
14 Correct 93 ms 2452 KB Output is correct
15 Correct 109 ms 2452 KB Output is correct
16 Correct 149 ms 2708 KB Output is correct
17 Correct 149 ms 2708 KB Output is correct
18 Correct 83 ms 2412 KB Output is correct
19 Correct 86 ms 2412 KB Output is correct
20 Correct 99 ms 2716 KB Output is correct
21 Correct 109 ms 2716 KB Output is correct
22 Correct 99 ms 2716 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 89 ms 2716 KB Output is correct
25 Correct 96 ms 2716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 2716 KB Output is correct
2 Correct 79 ms 2716 KB Output is correct
3 Correct 99 ms 2716 KB Output is correct
4 Correct 126 ms 2716 KB Output is correct
5 Correct 133 ms 2716 KB Output is correct
6 Correct 76 ms 2716 KB Output is correct
7 Correct 99 ms 2716 KB Output is correct
8 Correct 129 ms 2708 KB Output is correct
9 Correct 129 ms 2708 KB Output is correct
10 Correct 169 ms 2452 KB Output is correct
11 Correct 49 ms 2452 KB Output is correct
12 Correct 46 ms 2452 KB Output is correct
13 Correct 9 ms 2088 KB Output is correct
14 Correct 9 ms 2088 KB Output is correct
15 Correct 239 ms 2716 KB Output is correct
16 Correct 19 ms 2088 KB Output is correct
17 Correct 236 ms 2716 KB Output is correct
18 Correct 36 ms 2088 KB Output is correct
19 Correct 213 ms 2716 KB Output is correct
20 Correct 36 ms 2088 KB Output is correct
21 Correct 149 ms 2716 KB Output is correct
22 Correct 26 ms 2088 KB Output is correct
23 Correct 196 ms 2716 KB Output is correct
24 Correct 226 ms 2716 KB Output is correct
25 Correct 13 ms 2088 KB Output is correct
26 Correct 146 ms 2716 KB Output is correct
27 Correct 13 ms 2088 KB Output is correct
28 Correct 136 ms 2716 KB Output is correct
29 Correct 23 ms 2088 KB Output is correct
30 Correct 136 ms 2716 KB Output is correct
31 Correct 16 ms 2088 KB Output is correct
32 Correct 139 ms 2716 KB Output is correct
33 Correct 19 ms 2088 KB Output is correct
34 Correct 209 ms 2716 KB Output is correct
35 Correct 219 ms 2716 KB Output is correct
36 Correct 256 ms 2716 KB Output is correct
37 Correct 253 ms 2716 KB Output is correct
38 Correct 249 ms 2708 KB Output is correct
39 Correct 203 ms 2708 KB Output is correct
40 Correct 243 ms 2708 KB Output is correct
41 Correct 109 ms 2708 KB Output is correct
42 Correct 249 ms 2708 KB Output is correct
43 Correct 239 ms 2708 KB Output is correct
44 Correct 183 ms 2708 KB Output is correct
45 Correct 179 ms 2708 KB Output is correct
46 Correct 209 ms 2708 KB Output is correct
47 Correct 196 ms 2708 KB Output is correct
48 Correct 229 ms 2708 KB Output is correct
49 Correct 116 ms 2708 KB Output is correct
50 Correct 183 ms 2708 KB Output is correct
51 Correct 209 ms 2708 KB Output is correct
52 Correct 216 ms 2708 KB Output is correct
53 Correct 219 ms 2708 KB Output is correct
54 Correct 159 ms 2452 KB Output is correct
55 Correct 176 ms 2452 KB Output is correct
56 Correct 83 ms 2452 KB Output is correct
57 Correct 163 ms 2452 KB Output is correct
58 Correct 159 ms 2452 KB Output is correct
59 Correct 133 ms 2412 KB Output is correct
60 Correct 146 ms 2412 KB Output is correct
61 Correct 156 ms 2412 KB Output is correct
62 Correct 156 ms 2412 KB Output is correct
63 Correct 126 ms 2412 KB Output is correct
64 Correct 146 ms 2412 KB Output is correct
65 Correct 79 ms 2412 KB Output is correct
66 Correct 89 ms 2716 KB Output is correct
67 Correct 153 ms 2716 KB Output is correct
68 Correct 123 ms 2716 KB Output is correct
69 Correct 153 ms 2716 KB Output is correct
70 Correct 123 ms 2716 KB Output is correct
71 Correct 149 ms 2716 KB Output is correct
72 Correct 123 ms 2716 KB Output is correct
73 Correct 146 ms 2716 KB Output is correct
74 Correct 123 ms 2716 KB Output is correct
75 Correct 139 ms 2716 KB Output is correct
76 Correct 0 ms 1932 KB Output is correct
77 Correct 0 ms 1932 KB Output is correct
78 Correct 0 ms 1932 KB Output is correct
79 Correct 143 ms 2716 KB Output is correct
80 Correct 26 ms 2716 KB Output is correct
81 Correct 139 ms 2716 KB Output is correct
82 Correct 29 ms 2716 KB Output is correct
83 Correct 136 ms 2716 KB Output is correct
84 Correct 159 ms 2716 KB Output is correct
85 Correct 123 ms 2716 KB Output is correct
86 Correct 136 ms 2716 KB Output is correct
87 Correct 153 ms 2452 KB Output is correct
88 Correct 166 ms 2452 KB Output is correct
89 Correct 93 ms 2452 KB Output is correct
90 Correct 109 ms 2452 KB Output is correct
91 Correct 149 ms 2708 KB Output is correct
92 Correct 149 ms 2708 KB Output is correct
93 Correct 83 ms 2412 KB Output is correct
94 Correct 86 ms 2412 KB Output is correct
95 Correct 99 ms 2716 KB Output is correct
96 Correct 109 ms 2716 KB Output is correct
97 Correct 99 ms 2716 KB Output is correct
98 Correct 93 ms 2716 KB Output is correct
99 Correct 89 ms 2716 KB Output is correct
100 Correct 96 ms 2716 KB Output is correct