QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#140956 | #6743. water235 | cciafrino# | WA | 1ms | 3512kb | C++20 | 707b | 2023-08-17 01:18:22 | 2023-08-17 01:18:23 |
Judging History
answer
#include<bits/stdc++.h>
int main() {
using namespace std;
cin.tie(nullptr)->sync_with_stdio(false);
int N, M; cin >> N >> M;
vector<vector<int>> A(N, vector<int>(M));
if (N < M) {
A[0][M-1] = 1;
for (int i = 0; i < N; ++i) A[i][i] = 1;
for (int i = 0; i < M-N-1; ++i) A[0][i+N+1] = (i % 2 == 0);
} else {
A[N-1][0] = (N > M);
for (int i = 0; i < M; ++i) A[i][i] = 1;
for (int i = 0; i < N-M-1; ++i) A[i+M+1][0] = (i % 2 == 0);
}
int S = 0;
for (int i = 0; i < N; ++i) S += accumulate(A[i].begin(), A[i].end(), 0);
cout << S << '\n';
for (int i = 0; i < N; ++i) {
for (int j = 0; j < M; ++j) {
cout << A[i][j] << ' ';
}
cout << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3484kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3512kb
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: 1ms
memory: 3420kb
input:
1 4
output:
2 1 0 1 0
result:
wrong answer The answer is wrong: expected = 3, found = 2