QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#440256 | #7178. Bishops | lzytag | WA | 1ms | 3696kb | C++14 | 1.5kb | 2024-06-13 14:41:33 | 2024-06-13 14:41:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 5e5+5;
int n,m;
int main()
{
//freopen("bishop.in","r",stdin);
//freopen("bishop.out","w",stdout);
ios::sync_with_stdio(false);cin.tie(0);
cin>>n>>m;
if(n == m)
{
cout<<n+m-2<<"\n";
for(int i = 1;i <= n;i++) cout<<"1 "<<i<<"\n";
for(int i = 2;i < n;i++) cout<<n<<" "<<i<<"\n";
return 0;
}
if(n < m)
{
if(n & 1)
{
cout<<n+m-1<<"\n";
for(int i = 1;i <= n;i++) cout<<i<<" 1\n"<<i<<" "<<m<<"\n";
int fr = (n+1)/2+1,to = m-(n+1)/2;
for(int i = fr;i <= to;i++) cout<<(n+1)/2<<" "<<i<<"\n";
return 0;
}
m = (m-1)/2*2+1;
cout<<n+m-1<<"\n";
for(int i = 1;i <= n;i++) cout<<i<<" 1\n"<<i<<" "<<m<<"\n";
int fr = n/2+2,to = m-n/2-1;
for(int i = fr;i <= to;i+=2) cout<<n/2<<" "<<i<<"\n"<<n/2+1<<" "<<i<<"\n";
}
swap(n,m);
if(n & 1)
{
cout<<n+m-1<<"\n";
for(int i = 1;i <= n;i++) cout<<"1 "<<i<<"\n"<<m<<" "<<i<<"\n";
int fr = (n+1)/2+1,to = m-(n+1)/2;
for(int i = fr;i <= to;i++) cout<<i<<" "<<(n+1)/2<<"\n";
return 0;
}
m = (m-1)/2*2+1;
cout<<n+m-1<<"\n";
for(int i = 1;i <= n;i++) cout<<"1 "<<i<<"\n"<<m<<" "<<i<<"\n";
int fr = n/2+2,to = m-n/2-1;
for(int i = fr;i <= to;i+=2) cout<<i<<" "<<n/2<<"\n"<<i<<" "<<n/2+1<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3696kb
input:
2 5
output:
6 1 1 1 5 2 1 2 5 1 3 2 3 6 1 1 2 1 1 2 2 2 1 3 2 3 1 4 2 4 1 5 2 5
result:
wrong output format Extra information in the output file