QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#97614 | #6309. Aqre | ayersz | WA | 2ms | 3340kb | C++20 | 2.2kb | 2023-04-17 15:28:25 | 2023-04-17 15:28:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int solve();
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
const int N = 1005;
int ans[N][N];
int n, m;
int cnt;
const int d[5] = {0, 4, 2, 3, 1};
void print() {
cnt = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cnt += ans[i][j];
}
}
cout << cnt << "\n";
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cout << ans[i][j];
}
cout << "\n";
}
}
int solve() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
ans[i][j] = 0;
}
}
if (n <= 3 && m <= 3) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
ans[i][j] = 1;
}
}
print();
return 0;
}
if ((n == 3 && m == 4) || (n == 4 && m == 3)) {
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
ans[i][j] = 1;
}
}
print();
return 0;
}
if (n <= 3) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (j % 2 == 1) {
ans[i][j] = 1;
} else {
if (((j / 2) % 2 == 0 && i == 1) ||
((j / 2) % 2 == 1 && i == n)) {
ans[i][j] = 1;
}
}
}
}
print();
return 0;
}
if (m <= 3) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (((i / 2) % 2 == 0 && j == 1) ||
((i / 2) % 2 == 1 && j == m)) {
ans[i][j] = 1;
}
}
}
print();
return 0;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
int x = (i - 1) % 4 + 1, y = (j - 1) % 4 + 1;
if (d[x] != y) {
ans[i][j] = 1;
}
}
}
print();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3340kb
input:
3 2 2 3 4 3 8
output:
4 11 11 9 1110 1110 1110 16 10111011 10101010 11101110
result:
wrong answer ans finds a larger answer (test case 3)