# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23137 | ainta | Window Xor (KRIII5_WX) | C++14 | 1000 ms | 2004 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<cstdio>
#include<algorithm>
using namespace std;
int n, K, X[101000], TP[101000];
bool v[101000];
long long T;
int main(){
int i, j, c = 1, t1, t2;
scanf("%d%d%lld",&n,&K,&T);
for(i=0;i<n;i++)scanf("%d",&X[i]);
while(T){
if(T&1){
for(i=0;i<n;i++)v[i]=false;
for(i=0;i<n;i++){
if(v[i])continue;
t1 = t2 = i;
int s = 0;
for(j=0;j<K-1;j++){
s^= X[t2];
t2 = (t2 + c)%n;
}
for(;;){
v[t1] = true;
s ^= X[t2];
TP[t1] = s;
s ^= X[t1];
t2=(t2+c)%n;
t1=(t1+c)%n;
if(t1==i)break;
}
}
for(i=0;i<n;i++)X[i] = TP[i];
}
c=(c<<1)%n;
T>>=1;
}
for(i=0;i<n;i++)printf("%d ",X[i]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |