QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#757689#7629. Make SYSU Great Again II-OfastWA 1503ms9868kbC++111.1kb2024-11-17 12:15:242024-11-17 12:15:27

Judging History

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

  • [2024-11-17 12:15:27]
  • 评测
  • 测评结果:WA
  • 用时:1503ms
  • 内存:9868kb
  • [2024-11-17 12:15:24]
  • 提交

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;
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 7948kb

input:

4

output:

Yes
18 5 26 5 
13 18 5 26 
2 1 24 4 
17 12 2 25 

result:

ok 1

Test #2:

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

input:

1

output:

Yes
1 

result:

ok 1

Test #3:

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

input:

2

output:

Yes
2 5 
5 2 

result:

ok 1

Test #4:

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

input:

3

output:

Yes
6 8 5 
9 4 10 
6 8 5 

result:

ok 1

Test #5:

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

input:

5

output:

Yes
12 19 12 1 30 
19 8 17 14 1 
8 21 10 0 30 
23 8 0 31 0 
8 2 29 0 31 

result:

ok 1

Test #6:

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

input:

8

output:

Yes
1 124 3 52 72 55 72 21 
94 1 60 67 36 72 20 106 
33 12 67 36 89 6 105 4 
8 83 44 81 6 105 4 90 
87 32 65 10 97 20 74 37 
32 76 18 37 24 67 36 24 
78 17 36 74 5 56 0 103 
17 102 9 20 104 3 124 0 

result:

ok 1

Test #7:

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

input:

13

output:

Yes
166 89 164 26 101 154 96 15 144 102 137 118 137 
88 166 8 97 136 96 15 144 110 145 6 137 54 
35 72 50 140 82 133 80 47 144 14 241 6 201 
220 34 141 82 164 90 165 16 70 177 14 113 6 
3 156 66 172 81 36 90 165 24 6 112 134 121 
244 2 173 80 14 192 37 26 197 40 133 88 134 
10 229 16 14 225 28 130 6...

result:

ok 1

Test #8:

score: 0
Accepted
time: 3ms
memory: 7772kb

input:

21

output:

Yes
118 392 3 244 265 148 43 468 1 446 65 158 353 134 280 228 265 114 141 352 31 
393 18 484 8 182 328 148 11 500 0 176 257 154 96 133 282 96 141 322 25 416 
54 449 26 485 8 183 264 196 10 177 270 224 5 386 24 228 9 338 168 260 74 
193 30 481 10 245 264 196 315 132 74 161 286 224 25 356 11 80 172 33...

result:

ok 1

Test #9:

score: -100
Wrong Answer
time: 1503ms
memory: 7876kb

input:

34

output:


result:

wrong answer Unexpected Ans