QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#290176#6309. Aqrezzuqy#WA 1ms5776kbC++14676b2023-12-24 15:09:372023-12-24 15:09:37

Judging History

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

  • [2023-12-24 15:09:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5776kb
  • [2023-12-24 15:09:37]
  • 提交

answer

#include <bits/stdc++.h>
#define N 2009
using namespace std;
int a[N][N], b[N][N];
int n, m;

void solve() {
	cin >> n >> m;
	int cnt1 = 0, cnt2 = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			a[i][j] = (!!(i % 4) == !!(j % 4));
			b[i][j] = ((i + j) % 4 != 3);
			if (a[i][j])
				cnt1++;
			if (b[i][j])
				cnt2++;
		}
	}
	cout << max(cnt1, cnt2) << endl;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			int tmp = 0;
			if (cnt1 > cnt2)
				tmp = a[i][j];
			else
				tmp = b[i][j];
			putchar(tmp + '0');
		}
		putchar('\n');
	}
}

int main() {
	int t;
	cin >> t;
	while (t--)
		solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5776kb

input:

3
2 2
3 4
3 8

output:

4
11
11
9
1011
0111
1110
18
10111011
01110111
11101110

result:

wrong answer 1s are not connected. (test case 2)