Submission #23137

# Submission time Handle Problem Language Result Execution time Memory
23137 2017-05-03T11:51:14 Z ainta Window Xor (KRIII5_WX) C++14
2 / 7
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 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

WX.cpp: In function 'int main()':
WX.cpp:9: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:10:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=0;i<n;i++)scanf("%d",&X[i]);
                                      ^
# 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 106 ms 2004 KB Output is correct
5 Correct 29 ms 2004 KB Output is correct
6 Correct 113 ms 2004 KB Output is correct
7 Correct 29 ms 2004 KB Output is correct
8 Correct 123 ms 2004 KB Output is correct
9 Correct 113 ms 2004 KB Output is correct
10 Correct 113 ms 2004 KB Output is correct
11 Correct 119 ms 2004 KB Output is correct
12 Correct 69 ms 2004 KB Output is correct
13 Correct 86 ms 2004 KB Output is correct
14 Correct 73 ms 2004 KB Output is correct
15 Correct 69 ms 2004 KB Output is correct
16 Correct 109 ms 2004 KB Output is correct
17 Correct 109 ms 2004 KB Output is correct
18 Correct 66 ms 2004 KB Output is correct
19 Correct 69 ms 2004 KB Output is correct
20 Correct 86 ms 2004 KB Output is correct
21 Correct 86 ms 2004 KB Output is correct
22 Correct 79 ms 2004 KB Output is correct
23 Correct 83 ms 2004 KB Output is correct
24 Correct 79 ms 2004 KB Output is correct
25 Correct 89 ms 2004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 109 ms 2004 KB Output is correct
2 Correct 69 ms 2004 KB Output is correct
3 Correct 89 ms 2004 KB Output is correct
4 Correct 106 ms 2004 KB Output is correct
5 Correct 99 ms 2004 KB Output is correct
6 Correct 59 ms 2004 KB Output is correct
7 Correct 63 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 109 ms 2004 KB Output is correct
11 Correct 43 ms 2004 KB Output is correct
12 Correct 43 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 236 ms 2004 KB Output is correct
16 Correct 33 ms 2004 KB Output is correct
17 Correct 799 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 -