QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290202 | #6309. Aqre | zzuqy# | WA | 0ms | 3688kb | C++14 | 1002b | 2023-12-24 15:58:45 | 2023-12-24 15:58:45 |
Judging History
answer
#include <bits/stdc++.h>
#define N 2009
using namespace std;
int a[N][N];
int n, m;
void solve() {
cin >> n >> m;
bool sw = 0;
if (n > m)
sw = 1, swap(n, m);
if (n == 1)
for (int i = 1; i <= m; i++)
a[1][i] = (i <= 3);
else if (n == 2)
for (int i = 1; i <= m; i++)
a[1][i] = !(i % 4 == 2), a[2][i] = !(i % 4 == 0);
else {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (i % 4 + j % 4 == 1 || i % 4 == j % 4 && (i % 4 == 2 || j % 4 == 3))
a[i][j] = 0;
else
a[i][j] = 1;
}
}
}
int sum = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++)
sum += a[i][j];
}
cout << sum << endl;
if (sw == 0)
for (int i = 1; i <= n; i++, putchar('\n'))
for (int j = 1; j <= m; j++)
putchar(a[i][j] + '0');
else
for (int i = 1; i <= m; i++, putchar('\n'))
for (int j = 1; j <= n; j++)
putchar(a[j][i] + '0');
}
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: 0ms
memory: 3688kb
input:
3 2 2 3 4 3 8
output:
3 10 11 9 1110 1011 1101 18 11101110 10111011 11011101
result:
wrong answer ans finds a larger answer (test case 1)