QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103277 | #6309. Aqre | Nerovix# | WA | 2ms | 3316kb | C++20 | 1.8kb | 2023-05-04 23:02:08 | 2023-05-04 23:02:12 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk make_pair
#define pb push_back
#define eb emplace_back
#define ins insert
#define fi first
#define se second
#define For(x, y, z) for(int x = (y); x <= (z); x++)
#define Rep(x, y, z) for(int x = (y); x >= (z); x--)
using namespace std;
const int MAXN = 1e3 + 5;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
inline char gc() {
return (pp1 == pp2) && (pp2 = (pp1 = buf) + fread(buf, 1, 1 << 12, stdin), pp1 == pp2) ? EOF : *pp1++;
}
inline int read() {
int x = 0, ny = 1;
for(; nc = gc(), (nc < 48 || nc > 57) && nc != EOF; )
if(nc == '-') ny = -1;
if(nc < 0) return nc;
x = nc ^ 48;
for(; nc = gc(), (nc >= 48 && nc <= 57 && nc != EOF); )
x = (x << 3) + (x << 1) + (nc ^ 48);
return x * ny;
}
int n, m, ans[MAXN][MAXN], s[4][4] = {{1, 0, 1, 1}, {0, 1, 1, 1}, {1, 1, 0, 1}, {1, 1, 1, 0}};
int ss[4][4] = {{0, 0, 1, 0}, {0, 1, 1, 1}, {1, 1, 0, 1}, {0, 1, 1, 1}};
void Solve() {
n = read(), m = read();
int cnt = 0;
if((n == 2 && m == 2) || (n == 2 && m == 3) || (n == 3 && m == 2) || (n == 3 && m == 3)) {
For(i, 1, n) For(j, 1, m) ans[i][j] = 1, cnt++;
} else if(n == 3 || m == 3) {
For(i, 1, n) For(j, 1, m) ans[i][j] = ss[i % 4][j % 4], cnt += ans[i][j];
}
else {
For(i, 1, n) For(j, 1, m)
ans[i][j] = s[i % 4][j % 4], cnt += ans[i][j];
}
cout << cnt << '\n';
For(i, 1, n) {
For(j, 1, m) cout << ans[i][j] << ' ';
cout << '\n';
}
}
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
for(int t = read(); t--; ) {
Solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3316kb
input:
3 2 2 3 4 3 8
output:
4 1 1 1 1 9 1 1 1 0 1 0 1 1 1 1 1 0 18 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 0
result:
wrong answer Length must be equal to m (test case 1)