QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#528340 | #7178. Bishops | JoeyJ | WA | 0ms | 3572kb | C++14 | 833b | 2024-08-23 12:59:51 | 2024-08-23 12:59:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int flag=0;
if(n>m) swap(n,m),flag=0;
vector<pair<int,int>> res;
if(n==m){
for(int i=1;i<=n;i++) res.push_back({i,1});
for(int i=2;i<n;i++) res.push_back({i,n});
}else{
for(int i=1;i<=n;i++) res.push_back({i,1}),res.push_back({i,m});
if(n%2){
int k=n+1>>1;
for(int i=1+k;i<=m-k;i++) res.push_back({k,i});
}else{
int k=(n>>1)+1;
for(int i=i+k;i<=m-k;i++) res.push_back({k-1,i}),res.push_back({k,i});
}
}
cout<<res.size()<<endl;
for(pair<int,int> p:res){
if(!flag) cout<<p.first<<' '<<p.second<<endl;
else cout<<p.second<<' '<<p.first<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3572kb
input:
2 5
output:
8 1 1 1 5 2 1 2 5 1 2 2 2 1 3 2 3
result:
wrong answer Integer parameter [name=q] equals to 8, violates the range [0, 7]