QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#132644 | #6743. water235 | de_sousa# | WA | 1ms | 3448kb | C++17 | 951b | 2023-07-30 22:38:02 | 2023-07-30 22:38:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define all(x) begin(x),end(x)
#define trav(a, b) for (auto a : b)
#define lld long long
using i64 = long long;
void solve() {
int n, m;
cin >> n >> m;
// if (n > m) swap(n, m);
vector<vector<int> > ans(n, vector<int>(m));
int res = 0;
for (int i = 0; i < n; i++) {
if (i < m) {
ans[i][i] = 1;
++res;
}
}
if (n > m) {
for (int i = m; i < n; i++) {
++res;
ans[i][m - 1] = 1;
}
}
if (m > n) {
for (int i = n; i < m; i++) {
++res;
ans[0][i] = 1;
}
}
cout << res << '\n';
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cout << ans[i][j] << ' ';
}
cout << '\n';
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
// cin >> tt;
while (tt--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3444kb
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: 3444kb
input:
1 4
output:
4 1 1 1 1
result:
wrong answer The answer is wrong: expected = 3, found = 4