QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#311155 | #7178. Bishops | Minhho | WA | 1ms | 3808kb | C++17 | 996b | 2024-01-21 23:38:02 | 2024-01-21 23:38:03 |
Judging History
answer
#define taskname "D"
#include <bits/stdc++.h>
#define ii pair<int,int>
#define ff first
#define ss second
using namespace std;
int n, m;
/**
- Leftmost column
- Rightmost column
- In the middle
**/
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin>>n>>m;
bool sw = 0;
if (n > m) swap(n, m), sw = 1;
vector<ii> ans;
for (int i=1; i<=n; i++) ans.emplace_back(i, 1);
for (int i=1+(n==m); i<=n-(n==m); i++) ans.emplace_back(i, m);
if (n & 1)
{
int mid = (n+1)/2;
int st = mid + 1, ed = m - mid;
for (int i=st; i<=ed; i++) ans.emplace_back(mid, i);
}
else
{
int mid = n/2;
int st = n, ed = m - n;
for (int i=st; i<=ed; i+=2) ans.emplace_back(mid, i), ans.emplace_back(mid+1, i);
}
cout<<ans.size()<<"\n";
for (auto [i, j]: ans)
{
if (sw) swap(i, j);
cout<<i<<" "<<j<<"\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3808kb
input:
2 5
output:
6 1 1 2 1 1 5 2 5 1 2 2 2
result:
wrong answer Sum diagonals are not distinct