QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#220613 | #6309. Aqre | ucup-team1883# | WA | 1ms | 5868kb | C++14 | 1.5kb | 2023-10-20 16:29:50 | 2023-10-20 16:29:50 |
Judging History
answer
#include <iostream>
const int N = 1005;
const int pat[4][4] = {
{1, 0, 1, 1},
{1, 1, 0, 1},
{1, 1, 1, 0},
{0, 1, 1, 1}
};
const int patt[4][4] = {
{1, 1, 1, 0},
{0, 1, 1, 1},
{1, 0, 1, 1},
{1, 1, 0, 1}
};
int ans[N][N], now[N][N];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n, m;
scanf("%d %d", &n, &m);
int mx = 0;
if (n < 4 && m < 4) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
ans[i][j] = 1;
}
}
mx = n * m;
}
{
int sum = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
now[i][j] = pat[i % 4][j % 4];
sum += now[i][j];
}
}
if (sum > mx) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
ans[i][j] = now[i][j];
}
}
mx = sum;
}
}
{
int sum = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
now[i][j] = patt[i % 4][j % 4];
sum += now[i][j];
}
}
if (sum > mx) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
ans[i][j] = now[i][j];
}
}
mx = sum;
}
}
printf("%d\n", mx);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
printf("%d", ans[i][j]);
}
puts("");
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5868kb
input:
3 2 2 3 4 3 8
output:
4 11 11 9 1011 1101 1110 18 10111011 11011101 11101110
result:
wrong answer 1s are not connected. (test case 2)