Submission #22590

#TimeUsernameProblemLanguageResultExecution timeMemory
22590팀명을 한번 정하면 못바꿀까? (#40)Window Xor (KRIII5_WX)C++14
2 / 7
1000 ms3052 KiB
#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;
vector<int> list[LOG_T];
int main() {
	scanf("%d%d%lld", &N, &K, &T);
	vector<int> Nr; Nr = vector<int>(N, 0);
	for(int i=0; i<N; i++) scanf("%d", &Nr[i]);
	for(int i=0; i<K; i++) list[0].push_back(i);

	int p2 = 1;
	while(T) {
		if(T%2) {
			vector<int> next; next = vector<int>(N, 0);
			vector<bool> chk; chk = vector<bool>(N, false);
			for(int s=0; s<N; s++) {
				if(chk[s] == true) continue;
				int l = s, r = (1ll * p2 * (K-1) + s) % N;
				for(int i=0; i<K; i++) next[s] ^= Nr[(1ll * p2 * i + s) % N]; 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 (stderr)

WX.cpp: In function 'int main()':
WX.cpp:22: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:24: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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...