QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#440256#7178. BishopslzytagWA 1ms3696kbC++141.5kb2024-06-13 14:41:332024-06-13 14:41:34

Judging History

你现在查看的是最新测评结果

  • [2024-06-13 14:41:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2024-06-13 14:41:33]
  • 提交

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