QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#757691 | #7629. Make SYSU Great Again II | -Ofast | WA | 1503ms | 9984kb | C++11 | 1.1kb | 2024-11-17 12:16:04 | 2024-11-17 12:16:05 |
Judging History
answer
#include <bits/stdc++.h>
#define mp make_pair
#define fir first
#define sec second
using namespace std;
const int N=2010;
int n,a[N][N],buk[N*N*4];
pair <int,int> b[N*N];
mt19937 rnd(time(0));
bitset <N> vis[N];
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;int lg=log2(n*n)+1;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)b[(i-1)*n+j]=mp(i,j);
while(1.0*clock()/CLOCKS_PER_SEC<1.5){
for(int k=0;k<lg;k++){
shuffle(b+1,b+1+n*n,rnd);
for(int i=1;i<=n;i++)vis[i].reset();
for(int i=1;i<=n*n;i++){
int x=b[i].fir,y=b[i].sec;
if(!vis[x][y]){
vis[x][y]=1;
vis[x-1][y]=1;
vis[x+1][y]=1;
vis[x][y-1]=1;
vis[x][y+1]=1;
a[x][y]|=(1<<k);
}
}
}
int flg=0;
for(int i=0;i<4*n*n;i++)buk[i]=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++){
buk[a[i][j]]++;
if(buk[a[i][j]]>5)flg=1;
}
if(!flg){
cout<<"Yes\n";
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++)
cout<<a[i][j]<<" ";
cout<<"\n";
}
return 0;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)a[i][j]=0;
}
cout<<"No\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 9984kb
input:
4
output:
Yes 8 5 26 1 23 8 1 30 8 19 4 1 19 4 25 6
result:
ok 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 9808kb
input:
1
output:
Yes 1
result:
ok 1
Test #3:
score: 0
Accepted
time: 0ms
memory: 7836kb
input:
2
output:
Yes 7 0 0 7
result:
ok 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 8020kb
input:
3
output:
Yes 13 2 12 2 12 1 12 1 14
result:
ok 1
Test #5:
score: 0
Accepted
time: 1ms
memory: 7892kb
input:
5
output:
Yes 30 1 18 13 16 1 2 13 16 15 2 29 0 15 16 25 0 27 0 15 4 27 4 11 16
result:
ok 1
Test #6:
score: 0
Accepted
time: 1ms
memory: 8028kb
input:
8
output:
Yes 5 58 65 44 19 108 19 108 114 5 58 1 76 2 76 19 13 98 1 14 32 89 34 76 66 16 14 113 10 36 88 3 40 71 32 10 4 89 2 124 23 40 81 4 115 0 100 3 64 17 14 49 12 97 26 100 57 70 49 76 35 28 97 26
result:
ok 1
Test #7:
score: 0
Accepted
time: 1ms
memory: 7900kb
input:
13
output:
Yes 195 60 192 47 208 39 24 199 0 225 30 193 58 52 131 28 192 15 208 5 32 157 2 129 58 132 11 84 163 28 224 9 50 140 96 157 98 132 73 212 42 20 226 25 38 200 49 134 96 144 73 182 10 149 104 21 162 88 33 70 40 145 78 32 64 112 8 151 32 73 164 90 128 1 102 1 208 47 133 114 0 73 150 65 132 43 212...
result:
ok 1
Test #8:
score: 0
Accepted
time: 35ms
memory: 8024kb
input:
21
output:
Yes 40 455 56 259 220 34 285 64 186 69 434 4 267 240 15 432 71 312 194 53 328 405 40 387 76 34 349 160 27 324 162 12 339 164 11 496 15 304 195 316 64 182 106 405 104 146 325 162 265 68 171 80 291 136 67 304 5 416 74 292 192 318 65 133 104 403 68 186 325 176 267 16 397 80 295 8 197 42 80 293 208 2...
result:
ok 1
Test #9:
score: 0
Accepted
time: 1473ms
memory: 7988kb
input:
34
output:
Yes 728 1318 721 1292 99 1948 97 926 1056 87 1928 55 1288 739 1308 611 1408 539 1060 970 1041 206 801 1174 841 1190 89 1958 64 1337 582 1457 590 1201 259 720 44 210 1804 99 524 1120 21 1928 55 1864 179 1292 739 24 551 1216 777 1040 684 1281 150 841 1074 840 1186 64 1337 710 1336 582 1185 844 1780 ...
result:
ok 1
Test #10:
score: -100
Wrong Answer
time: 1503ms
memory: 8056kb
input:
55
output:
No
result:
wrong answer Jury found answer but participant doesn't