# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22639 | 팀명을 한번 정하면 못바꿀까? (#40) | Window Xor (KRIII5_WX) | C++14 | 256 ms | 2716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |