제출 #23139

#제출 시각아이디문제언어결과실행 시간메모리
23139aintaWindow XOR (KRIII5_WX)C++14
7 / 7
249 ms2004 KiB
#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)*2)+1; for(j=0;j<TK-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]); }

컴파일 시 표준 에러 (stderr) 메시지

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