QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#140958 | #6743. water235 | UFRJ# | WA | 1ms | 3564kb | C++20 | 931b | 2023-08-17 01:25:50 | 2023-08-17 01:25:51 |
Judging History
answer
#include<bits/stdc++.h>
using lint = int64_t;
using namespace std;
int main(void) {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
int cnt = 0;
cin >> n >> m;
vector<vector<bool>> ans(n, vector<bool>(m));
for(int i = 0; i < n; i += 4) {
for(int j = 0; j < m; j += 2) {
ans[i][j] = 1;
cnt++;
}
}
for(int i = 2; i < n; i += 4) {
for(int j = 1-(m == 1); j < m; j += 2) {
ans[i][j] = 1;
cnt++;
}
}
if(n == 2 and m == 2) {
ans[0][1] = 1;
ans[1][0] = 1;
cnt += 2;
}
else if(m == 2) {
ans[0][1] = 1;
cnt++;
} else if(n == 2) {
ans[1][0] = 1;
cnt++;
}
if(n % 2 == 0 and n != 2) {
ans[n-1][0] = 1;
}
cout << cnt << "\n";
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
cout << ans[i][j] << " ";
}
cout << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3460kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
3 3
output:
3 1 0 1 0 0 0 0 1 0
result:
ok The answer is correct.
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3532kb
input:
1 4
output:
2 1 0 1 0
result:
wrong answer The answer is wrong: expected = 3, found = 2