Submission #22416

# Submission time Handle Problem Language Result Execution time Memory
22416 2017-04-30T04:29:47 Z 버거킹 송죽SK점 우수고객(#1039, Namnamseo, khsoo01) Window Xor (KRIII5_WX) C++14
0 / 7
1000 ms 11004 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second

int n, k;
ll t;
int a[2][100010];

int sp[21][100010];

void trans(int h, int F, int T){
	ll w = (1ll << h) % n;
	for(int i=0; i<n; ++i){
		sp[0][i] = a[F][i];
	}
	for(int i=1; i<=20; ++i){
		for(int j=0; j<n; ++j){
			sp[i][j]=sp[i-1][j] ^ sp[i-1][(j+w*(1<<(i-1)))%n];
		}
	}
	for(int i=0; i<n; ++i){
		a[T][i] = 0;
		ll p=i;
		for(int j=20; 0<=j; --j){
			if(1&(k>>j)){
				a[T][i] ^= sp[j][p];
				p += w*(1<<j);
				p %= n;
			}
		}
	}
}

int main()
{
	read(n, k, t);
	int F=0, T=1;
	for(int i=0; i<n; ++i){
		read(a[F][i]);
	}
	for(int i=62; 0<=i; --i){
		if(1 & (t>>i)) trans(i, F, T), swap(F, T);
	}
	for(int i=0; i<n; ++i){
		printf("%d ", a[F][i]);
	}
    return 0;
}

Compilation message

WX.cpp: In function 'void read(int&)':
WX.cpp:6:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void read(int& x){ scanf("%d",&x); }
                                  ^
WX.cpp: In function 'void read(ll&)':
WX.cpp:7:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void read(ll& x){ scanf("%lld",&x); }
                                   ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11004 KB Output is correct
2 Correct 0 ms 11004 KB Output is correct
3 Correct 0 ms 11004 KB Output is correct
4 Execution timed out 1000 ms 11004 KB Execution timed out
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 11004 KB Execution timed out
2 Halted 0 ms 0 KB -