QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103269 | #6309. Aqre | Nerovix# | WA | 2ms | 3348kb | C++20 | 1.6kb | 2023-05-04 22:27:03 | 2023-05-04 22:27:08 |
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] = {{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)) {
For(i, 1, n) For(j, 1, m) ans[i][j] = 1, cnt++;
} 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3348kb
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)