QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#425184 | #7178. Bishops | real_sigma_team# | WA | 128ms | 23576kb | C++23 | 1.1kb | 2024-05-29 23:44:55 | 2024-05-29 23:44:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
bool rev = false;
if (n > m)
swap(n, m), rev = true;
vector<pair<int, int>> ans;
set<int> used1, used2;
for (int i = 1; i <= n; ++i) {
ans.push_back({i, 1});
used1.insert(i - 1);
used2.insert(i + 1);
}
for (int i = 1; i <= n; ++i) {
if (!used1.count(i - m) && !used2.count(i + m)) {
ans.push_back({i, m});
used1.insert(i - m);
used2.insert(i + m);
}
}
for (int i = 1; i <= m; ++i) {
for (int j = n / 2; j <= n / 2 + 1; ++j) {
if (!used1.count(j - i) && !used2.count(j + i)) {
ans.push_back({j, i});
used1.insert(j - i);
used2.insert(j + i);
}
}
}
cout << ans.size() << '\n';
for (auto i : ans) {
if (rev)
swap(i.first, i.second);
cout << i.first << ' ' << i.second << '\n';
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
input:
2 5
output:
6 1 1 2 1 1 5 2 5 1 3 2 3
result:
ok n: 2, m: 5, bishops: 6
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
5 5
output:
8 1 1 2 1 3 1 4 1 5 1 2 5 3 5 4 5
result:
ok n: 5, m: 5, bishops: 8
Test #3:
score: 0
Accepted
time: 128ms
memory: 23576kb
input:
100000 100000
output:
199998 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61...
result:
ok n: 100000, m: 100000, bishops: 199998
Test #4:
score: 0
Accepted
time: 127ms
memory: 23388kb
input:
100000 99999
output:
199998 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 ...
result:
ok n: 100000, m: 99999, bishops: 199998
Test #5:
score: 0
Accepted
time: 81ms
memory: 18444kb
input:
100000 50000
output:
149998 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 ...
result:
ok n: 100000, m: 50000, bishops: 149998
Test #6:
score: -100
Wrong Answer
time: 56ms
memory: 13372kb
input:
1 100000
output:
100000 1 1 1 100000 0 1 0 3 1 3 0 5 1 5 0 7 1 7 0 9 1 9 0 11 1 11 0 13 1 13 0 15 1 15 0 17 1 17 0 19 1 19 0 21 1 21 0 23 1 23 0 25 1 25 0 27 1 27 0 29 1 29 0 31 1 31 0 33 1 33 0 35 1 35 0 37 1 37 0 39 1 39 0 41 1 41 0 43 1 43 0 45 1 45 0 47 1 47 0 49 1 49 0 51 1 51 0 53 1 53 0 55 1 55 0 57 1 57 0 59...
result:
wrong answer Integer parameter [name=x] equals to 0, violates the range [1, 1]