QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#347817 | #6743. water235 | wtz2333 | WA | 0ms | 3748kb | C++14 | 1.9kb | 2024-03-09 15:38:11 | 2024-03-09 15:38:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mo = 998244353;
const int P = 1e9 + 7;
const int maxn = 2010;
int f[maxn][maxn];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n >> m;
if(m == 1) {
cout << n / 2 + 1 << endl;
for(int j = 0;j < n;j ++) {
if(j % 2 == 0)cout << 1 << "\n";
else if(j % 2 == 1 && j == n - 1) cout << 1 << "\n";
else cout << 0 << "\n";
}
return 0;
}
if(n == 1) {
cout << m / 2 + 1 << endl;
for(int j = 0;j < m;j ++) {
if(j % 2 == 0)cout << 1 << " ";
else if(j % 2 == 1 && j == m - 1) cout << 1 << " ";
else cout << 0 << " ";
}
return 0;
}
int cnt = 0;
// int nn,mm;
// if(n % 2 == 0) nn = n - 1;
// else nn = n;
// if(m % 2 == 0) mm = m - 1;
// else mm = m;
for(int i = 0;i < n;i ++) {
for(int j = 0;j < m;j ++) {
if(i % 3 == 0) {
if(j % 3 == 0){
cnt ++;
f[i][j] = 1;
}
}else if(i % 3 == 1){
if(j % 3 == 1) {
cnt++;
f[i][j] = 1;
}
}else if(i % 3 == 2) {
if(j % 3 == 2) {
cnt ++;
f[i][j] = 1;
}
}
}
}
// if(n % 2 == 0) {
// f[n - 1][0] = 1;
// cnt ++;
// }
// if(m % 2 == 0){
// f[0][m - 1] = 1;
// cnt ++;
//}
cout << cnt << endl;
for(int i = 0;i < n;i ++) {
for(int j = 0;j < m;j ++) {
cout << f[i][j] << " ";
}cout << "\n";
}
// }
}
// 1 0 0 1 0 0
// 0 1 0 0 1 0
// 1 0 0 1 0 0
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
3 3
output:
3 1 0 0 0 1 0 0 0 1
result:
ok The answer is correct.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
1 4
output:
3 1 0 1 1
result:
ok The answer is correct.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 2
output:
2 1 0 0 1
result:
ok The answer is correct.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 4
output:
3 1 0 0 1 0 1 0 0
result:
ok The answer is correct.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
4 3
output:
4 1 0 0 0 1 0 0 0 1 1 0 0
result:
ok The answer is correct.
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3624kb
input:
4 4
output:
6 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1
result:
wrong answer The answer is wrong: expected = 4, found = 6