QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211622 | #6743. water235 | psycho# | WA | 1ms | 3536kb | C++14 | 1.4kb | 2023-10-12 19:29:44 | 2023-10-12 19:29:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
pair<int, vector<vector<int>>> get(int n, int m) {
vector<vector<int>> a(n, vector<int>(m, 0));
int cnt = 0;
for (int i = 0, s = 0; i < n; i += 2, s ^= 1) {
for (int j = s; j < m; j += 2) {
a[i][j] = 1;
++cnt;
}
if (n % 2 == 0 && i + 1 == n - 1) {
for (int j = 0; j < m; j += 2) {
a[i + 1][j] = 1;
++cnt;
}
}
}
return make_pair(cnt, a);
}
void print(vector<vector<int>> a) {
for (auto &el: a) {
for (auto &i: el) cerr << i << ' ';
cerr << '\n';
}
cerr << '\n';
}
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
bool fl = true;
if (n < m) {
swap(n, m);
fl = false;
}
vector<pair<int, int>> x;
for (int i = 0; i < m; ++i) {
x.push_back({i + 1, i + 1});
}
while (x.back().first < n) x.push_back({min(x.back().first + 2, n), 1});
vector<vector<int>> o(n, vector<int>(m));
if (fl) {
cout << x.size() << '\n';
for (auto [x, y] : x) o[x - 1][y - 1] = 1;
} else {
cout << x.size() << '\n';
for (auto [y, x] : x) o[x - 1][y - 1] = 1;
}
for (auto &i : o) {
for (auto &j : i) cout << j << ' ';
cout << '\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3464kb
input:
2 1
output:
2 1 1
result:
ok The answer is correct.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3536kb
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: 3508kb
input:
1 4
output:
3 1 0 0 0
result:
wrong answer Invalid output