# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23138 | 2017-05-03T11:55:59 Z | ainta | Window Xor (KRIII5_WX) | C++14 | 1000 ms | 2004 KB |
#include<cstdio> #include<algorithm> using namespace std; int n, K, X[101000], TP[101000]; bool v[101000]; long long T; int gcd(int a, int b){ return b?gcd(b,a%b):a; } 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; int TK = (K-1)%(n/gcd(c,n))+1; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2004 KB | Output is correct |
2 | Correct | 0 ms | 2004 KB | Output is correct |
3 | Correct | 0 ms | 2004 KB | Output is correct |
4 | Correct | 126 ms | 2004 KB | Output is correct |
5 | Correct | 36 ms | 2004 KB | Output is correct |
6 | Correct | 119 ms | 2004 KB | Output is correct |
7 | Correct | 29 ms | 2004 KB | Output is correct |
8 | Correct | 116 ms | 2004 KB | Output is correct |
9 | Correct | 116 ms | 2004 KB | Output is correct |
10 | Correct | 113 ms | 2004 KB | Output is correct |
11 | Correct | 116 ms | 2004 KB | Output is correct |
12 | Correct | 89 ms | 2004 KB | Output is correct |
13 | Correct | 99 ms | 2004 KB | Output is correct |
14 | Correct | 73 ms | 2004 KB | Output is correct |
15 | Correct | 76 ms | 2004 KB | Output is correct |
16 | Correct | 109 ms | 2004 KB | Output is correct |
17 | Correct | 116 ms | 2004 KB | Output is correct |
18 | Correct | 66 ms | 2004 KB | Output is correct |
19 | Correct | 66 ms | 2004 KB | Output is correct |
20 | Correct | 93 ms | 2004 KB | Output is correct |
21 | Correct | 76 ms | 2004 KB | Output is correct |
22 | Correct | 79 ms | 2004 KB | Output is correct |
23 | Correct | 76 ms | 2004 KB | Output is correct |
24 | Correct | 96 ms | 2004 KB | Output is correct |
25 | Correct | 79 ms | 2004 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 116 ms | 2004 KB | Output is correct |
2 | Correct | 66 ms | 2004 KB | Output is correct |
3 | Correct | 96 ms | 2004 KB | Output is correct |
4 | Correct | 109 ms | 2004 KB | Output is correct |
5 | Correct | 129 ms | 2004 KB | Output is correct |
6 | Correct | 59 ms | 2004 KB | Output is correct |
7 | Correct | 86 ms | 2004 KB | Output is correct |
8 | Correct | 113 ms | 2004 KB | Output is correct |
9 | Correct | 109 ms | 2004 KB | Output is correct |
10 | Correct | 146 ms | 2004 KB | Output is correct |
11 | Correct | 43 ms | 2004 KB | Output is correct |
12 | Correct | 46 ms | 2004 KB | Output is correct |
13 | Correct | 9 ms | 2004 KB | Output is correct |
14 | Correct | 9 ms | 2004 KB | Output is correct |
15 | Correct | 219 ms | 2004 KB | Output is correct |
16 | Correct | 36 ms | 2004 KB | Output is correct |
17 | Correct | 803 ms | 2004 KB | Output is correct |
18 | Correct | 59 ms | 2004 KB | Output is correct |
19 | Execution timed out | 1000 ms | 2004 KB | Execution timed out |
20 | Halted | 0 ms | 0 KB | - |