QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188468 | #7178. Bishops | DAleksa | WA | 0ms | 3548kb | C++14 | 1.2kb | 2023-09-25 21:07:01 | 2023-09-25 21:07:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
if(n == m) {
cout << n + m - 2 << "\n";
for(int i = 1; i <= n - 1; i++) cout << "1 " << i << "\n" << m << " " << i << "\n";
return 0;
}
bool swapped = false;
if(n > m) {
swap(n, m);
swapped = true;
}
if(true) {
vector<pair<int, int>> res;
for(int i = 1; i <= n; i++) res.push_back({i, 1});
for(int i = 1; i <= n; i++) res.push_back({i, m});
int start = (n + 1) / 2 + 2, finish = m - (n + 1) / 2 - 1;
for(int i = start; i <= finish; i++) res.push_back({(n + 1) / 2, i});
if(swapped) {
for(int i = 0; i < res.size(); i++) {
swap(res[i].first, res[i].second);
}
}
cout << res.size() << "\n";
for(int i = 0; i < res.size(); i++) cout << res[i].first << " " << res[i].second << "\n";
return 0;
}
// vector<pair<int, int>> res;
// for(int i = 1; i <= n; i++) res.push_back({i, 1});
// for(int i = 1; i <= n; i++) res.push_back({i, m});
// int start = n / 2 + 1, fini
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3548kb
input:
2 5
output:
5 1 1 2 1 1 5 2 5 1 3
result:
wrong answer Participant's answer is not optimal (5 < 6)