QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218552 | #6743. water235 | retr0 | WA | 0ms | 3808kb | C++14 | 911b | 2023-10-18 14:56:24 | 2023-10-18 14:56:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m; cin >> n >> m;
int ans = 0;
vector<vector<int>> a(n, vector<int>(m));
for(int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (i == j) a[i][j] = 1, ans++;
}
}
if(n != m) {
if(n > m) {
for(int i = 0, j = 0; i + 3 < n; i++, j++) {
a[i + 3][j] = 1;
ans++;
}
} else {
for(int i = 0, j = 0; i < n; i++) {
while (j + 3 < m) {
a[i][j + 3] = 1;
j++;
ans++;
}
}
}
}
cout << ans << '\n';
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
cout << a[i][j] << " ";
}
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3808kb
input:
2 1
output:
1 1 0
result:
wrong answer The answer is wrong: expected = 2, found = 1