QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#226810 | #7629. Make SYSU Great Again II | comeintocalm# | RE | 0ms | 0kb | C++20 | 1.0kb | 2023-10-26 16:44:41 | 2023-10-26 16:44:41 |
answer
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 2005, TEST = 10;
const int fx[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int MX;
int RD()
{
return (rand() ^ (rand() << 15)) % MX;
}
int n;
int a[MAXN][MAXN];
int cnt[MAXN*MAXN*4];
int isfail;
int main()
{
scanf("%d", &n);
MX = 4*n*n;
isfail = 0;
for (int i = 1;i <= n; i++) {
//printf("%d(%d)\n", i, MX);
for (int j = 1;j <= n; j++) {
int via = ~(a[i-1][j] | a[i][j-1]);
int MI = RD() & via;
//printf("%d\n", j);
for (int cas = 1; cas <= TEST; cas++) {
int x = RD() & via;
//printf("#%d %d\n", x, MI);
if (cnt[MI] > cnt[x]) {
MI = x;
}
//printf("%d(%d)\n", x, via);
}
if (cnt[MI] > 5) {
isfail = 1;
break;
}
cnt[MI]++;
a[i][j] = MI;
}
if (isfail == 1) {
break;
}
}
if (isfail == 1) {
printf("No\n");
} else {
printf("Yes\n");
for (int i = 1;i <= n; i++) {
for (int j = 1;j <= n; j++) {
printf("%d%c", a[i][j], j==n?'\n':' ');
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
4