QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226821#7629. Make SYSU Great Again IIcomeintocalm#RE 0ms0kbC++20881b2023-10-26 16:50:112023-10-26 16:50:11

Judging History

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

  • [2023-10-26 16:50:11]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-10-26 16:50:11]
  • 提交

answer

#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 2105, TEST = 7;
int MX;
int RD()
{
	return (rand() ^ (rand() << 14)) % 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++) {
		for (int j = 1;j <= n; j++) {
			int via = ~(a[i-1][j] | a[i][j-1]);
			int MI = RD() & via;
			for (int cas = 1; cas <= TEST; cas++) {
				int x = RD() & via;
				if (cnt[MI] > cnt[x]) {
					MI = x;
				}
			}
			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':' ');
			}
		}
	}
}

详细

Test #1:

score: 0
Runtime Error

input:

4

output:


result: