QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#528340#7178. BishopsJoeyJWA 0ms3572kbC++14833b2024-08-23 12:59:512024-08-23 12:59:52

Judging History

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

  • [2024-08-23 12:59:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-08-23 12:59:51]
  • 提交

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;
}

详细

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]