QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#132643 | #6743. water235 | bucketpotato# | WA | 1ms | 3488kb | C++20 | 829b | 2023-07-30 22:36:38 | 2023-07-30 22:36:42 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int n, m; cin >> n >> m;
cout << max(n, m) << "\n";
vector<vector<int>> ans(n, vector<int>(m));
if (n >= m) {
int ci = 0;
int chg = 1;
for (int i = 0; i < n; i++) {
ans[i][ci] = 1;
ci += chg;
if (ci == m || ci == -1) {
chg *= -1;
ci += chg;
}
}
}
else {
int ci = 0;
int chg = 1;
for (int i = 0; i < m; i++) {
ans[ci][i] = 1;
ci += chg;
if (ci == n || ci == -1) {
chg *= -1;
ci += chg;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << ans[i][j] << " \n"[j == m - 1];
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3452kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
3 3
output:
3 1 0 0 0 1 0 0 0 1
result:
ok The answer is correct.
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3456kb
input:
1 4
output:
4 1 1 1 1
result:
wrong answer The answer is wrong: expected = 3, found = 4