QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#538904 | #7178. Bishops | Max_FWL | WA | 0ms | 3632kb | C++14 | 1.0kb | 2024-08-31 13:32:28 | 2024-08-31 13:32:28 |
Judging History
answer
#include <bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
int n, m, fl = 0;
vector<pii> ans;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
if (n > m){
swap(n, m);
fl = 1;
}
if (n == 1){
for (int i = 1; i <= n; i++)
ans.push_back(mp(1, i));
}if (n == m){
for (int i = 1; i <= n; i++)
ans.push_back(mp(i, 1));
for (int i = 2; i < n; i++)
ans.push_back(mp(i, m));
}else{
for (int i = 1; i <= n; i++){
ans.push_back(mp(i, 1));
ans.push_back(mp(i, m));
}
if (n & 1){
for (int i = (n >> 1) + 2; i <= m - (n >> 1) - 1; i++)
ans.push_back(mp(i, (n + 1) >> 1));
}else{
for (int i = (n >> 1) + 2; i <= m - (n >> 1) - 1; i += 2){
ans.push_back(mp(i, n >> 1));
ans.push_back(mp(i, (n >> 1) + 1));
}
}
}
cout << ans.size() << endl;
for (auto pos : ans)
cout << (fl ? pos.se : pos.fi) << " " << (fl ? pos.fi : pos.se) << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
input:
2 5
output:
6 1 1 1 5 2 1 2 5 3 1 3 2
result:
wrong answer Integer parameter [name=x] equals to 3, violates the range [1, 2]