QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#757864#7629. Make SYSU Great Again IIji_114514WA 1497ms10028kbC++201.5kb2024-11-17 14:07:182024-11-17 14:07:23

Judging History

你现在查看的是最新测评结果

  • [2024-11-17 14:07:23]
  • 评测
  • 测评结果:WA
  • 用时:1497ms
  • 内存:10028kb
  • [2024-11-17 14:07:18]
  • 提交

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: 7968kb

input:

4

output:

Yes
26 1 22 8 
4 26 0 23 
27 4 27 0 
4 27 0 31 

result:

ok 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 9972kb

input:

1

output:

Yes
1 

result:

ok 1

Test #3:

score: 0
Accepted
time: 1ms
memory: 7812kb

input:

2

output:

Yes
1 6 
6 1 

result:

ok 1

Test #4:

score: 0
Accepted
time: 0ms
memory: 10028kb

input:

3

output:

Yes
2 13 2 
13 2 8 
2 8 7 

result:

ok 1

Test #5:

score: 0
Accepted
time: 0ms
memory: 7856kb

input:

5

output:

Yes
13 16 7 24 7 
18 12 16 7 0 
12 19 12 0 31 
16 8 16 15 0 
11 20 11 16 15 

result:

ok 1

Test #6:

score: 0
Accepted
time: 1ms
memory: 7860kb

input:

8

output:

Yes
83 4 106 21 104 22 65 58 
44 82 5 34 20 97 10 68 
83 12 50 72 3 8 116 11 
40 83 8 21 104 22 9 84 
5 8 37 74 5 0 86 41 
122 5 90 37 18 105 0 86 
1 122 5 80 41 4 90 33 
126 1 88 35 84 42 1 94 

result:

ok 1

Test #7:

score: 0
Accepted
time: 0ms
memory: 9828kb

input:

13

output:

Yes
190 64 153 102 8 243 12 226 1 190 65 188 67 
65 150 96 136 115 12 226 25 164 65 148 67 172 
132 105 128 55 136 67 24 164 90 132 107 132 80 
122 0 47 192 17 44 131 88 133 112 132 80 171 
5 138 80 13 98 145 104 133 112 142 113 138 20 
2 117 10 240 13 34 5 90 132 113 134 49 74 
233 2 112 15 48 69 1...

result:

ok 1

Test #8:

score: 0
Accepted
time: 11ms
memory: 7984kb

input:

21

output:

Yes
370 141 66 284 163 92 418 17 172 336 171 4 467 40 21 458 49 206 273 96 415 
13 80 429 66 268 163 16 108 275 168 84 427 0 21 458 33 206 273 98 397 64 
240 270 16 301 210 12 65 402 104 23 424 80 269 226 5 218 288 206 257 82 429 
12 145 364 146 44 321 182 73 150 264 84 299 192 5 250 260 195 288 150...

result:

ok 1

Test #9:

score: 0
Accepted
time: 362ms
memory: 8008kb

input:

34

output:

Yes
1835 212 1314 149 554 1349 698 1285 74 1201 780 1139 644 1370 549 210 1292 755 268 1267 12 992 1043 936 1108 171 832 1174 297 1732 307 1732 280 1767 
212 1314 665 1122 276 170 1349 10 1969 12 1139 900 89 548 1496 36 595 12 1203 524 1392 11 804 1105 938 80 1158 873 1174 289 1548 274 1761 264 
131...

result:

ok 1

Test #10:

score: -100
Wrong Answer
time: 1497ms
memory: 9936kb

input:

55

output:

No

result:

wrong answer Jury found answer but participant doesn't