QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#302680 | #7178. Bishops | ivaziva | WA | 1ms | 3532kb | C++14 | 2.9kb | 2024-01-11 06:13:15 | 2024-01-11 06:13:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,m;
cin>>n>>m;
if (n==m)
{
cout<<n+m-2<<endl;
for (long long i=1;i<=n;i++) cout<<1<<" "<<i<<endl;
for (long long i=2;i<=n-1;i++) cout<<n<<" "<<i<<endl;
return 0;
}
if (n<m)
{
if (n%2==1)
{
cout<<n+m-1<<endl;
for (long long i=1;i<=n;i++) cout<<i<<" "<<1<<endl;
for (long long i=1;i<=n;i++) cout<<i<<" "<<m<<endl;
long long sredina=(n+1)/2;
for (long long i=sredina+1;i<=m-sredina;i++) cout<<sredina<<" "<<i<<endl;
return 0;
}
if (m%2==1)
{
cout<<n+m-1<<endl;
for (long long i=1;i<=n;i++) cout<<i<<" "<<1<<endl;
for (long long i=1;i<=n;i++) cout<<i<<" "<<m<<endl;
long long sredina1=n/2;
long long sredina2=sredina1+1;
for (long long i=sredina2;i<=m-sredina2;i+=2) cout<<sredina1<<" "<<i<<endl;
for (long long i=sredina2;i<=m-sredina2;i+=2) cout<<sredina2<<" "<<i<<endl;
}
else
{
cout<<n+m-2<<endl;m--;
for (long long i=1;i<=n;i++) cout<<i<<" "<<1<<endl;
for (long long i=1;i<=n;i++) cout<<i<<" "<<m<<endl;
long long sredina1=n/2;
long long sredina2=sredina1+1;
for (long long i=sredina2;i<=m-sredina2;i+=2) cout<<sredina1<<" "<<i<<endl;
for (long long i=sredina2;i<=m-sredina2;i+=2) cout<<sredina2<<" "<<i<<endl;
}
}
else
{
if (m%2==1)
{
cout<<n+m-1<<endl;
for (long long i=1;i<=m;i++) cout<<1<<" "<<i<<endl;
for (long long i=1;i<=m;i++) cout<<n<<" "<<i<<endl;
long long sredina=(m+1)/2;
for (long long i=sredina+1;i<=n-sredina;i++) cout<<i<<" "<<sredina<<endl;
return 0;
}
if (n%2==1)
{
cout<<n+m-1<<endl;
for (long long i=1;i<=m;i++) cout<<1<<" "<<i<<endl;
for (long long i=1;i<=m;i++) cout<<n<<" "<<i<<endl;
long long sredina1=m/2;
long long sredina2=sredina1+1;
for (long long i=sredina2;i<=n-sredina2;i+=2) cout<<i<<" "<<sredina1<<endl;
for (long long i=sredina2;i<=n-sredina2;i+=2) cout<<i<<" "<<sredina2<<endl;
}
else
{
cout<<n+m-2<<endl;n--;
for (long long i=1;i<=m;i++) cout<<1<<" "<<i<<endl;
for (long long i=1;i<=m;i++) cout<<n<<" "<<i<<endl;
long long sredina1=m/2;
long long sredina2=sredina1+1;
for (long long i=sredina2;i<=n-sredina2;i+=2) cout<<i<<" "<<sredina1<<endl;
for (long long i=sredina2;i<=n-sredina2;i+=2) cout<<i<<" "<<sredina2<<endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3532kb
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