QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772563 | #7629. Make SYSU Great Again II | Crysfly | WA | 0ms | 3596kb | C++14 | 1.8kb | 2024-11-22 20:20:09 | 2024-11-22 20:20:10 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
//#define ll __int128
//#define ull unsigned long long
#define int long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<ll,ll>pii;
typedef vector<int>vi;
#define maxn 5005
#define inf 0x3f3f3f3f
int n,k;
int b[maxn];
bool vis[maxn];
int a[maxn][maxn];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
signed main(){
cin>>n;
while((1<<k)<n)k++;
For(i,0,(1<<k)-1){
b[i]=(i^(i>>1));
if(vis[b[i]]) puts("qaq"),exit(0);
vis[b[i]]=1;
}
For(i,0,(1<<k)-1){
For(j,0,(1<<k)-1) {
int u=(i+j)/2;
int v=(i-j)/2+(1<<k)/2;
a[i][j]=(b[u]<<k)|b[v];
}
}
For(i,0,(1<<k)-1)
For(j,0,(1<<k)-1)
if((i+j)&1){
int w=0;
For(d,0,3){
int x=i+dx[d];
int y=j+dy[d];
if(x>=0 && y>=0 && x<(1<<k) && y<(1<<k)) w|=a[x][y];
}
a[i][j]=w^((1<<k)-1);
}
cout<<"Yes\n";
For(i,0,n-1) For(j,0,n-1) cout<<a[i][j]<<" \n"[j==n-1];
return 0;
}
/*
4
0000
0111
1100
1011
0110
0001
1010
1101
0011
0100
1111
1000
0101
0010
1001
1110
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
4
output:
Yes 3 4 5 14 4 7 12 13 6 12 15 12 13 14 12 11
result:
wrong answer There exist two adjacent numbers whose bitwise AND value is greater than 0.