QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406858#5528. Least Annoying Constructive ProblemJryno1WA 1ms3592kbC++14749b2024-05-07 19:22:282024-05-07 19:22:29

Judging History

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

  • [2024-05-07 19:22:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3592kb
  • [2024-05-07 19:22:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    cin>>n;
    if(n&1){
        for(int i=0;i<n;i++){
            int r=(i-1+n)%n,l=(i+1)%n;
            for(int j=1;j<=n/2;j++){
                cout<<l+1<<" "<<r+1<<"\n";
                l++,l%=n;
                r+=n-1,r%=n;
            }
        }
    } else {
        for(int i=1;i<n;i++){
            int r=(i-1+n)%n,l=(i+1)%n;
            cout<<1<<" "<<i+1<<"\n";
            if(!r)r=n-1;
            if(!l)l=1;
            for(int j=1;j<n/2;j++){
                cout<<l+1<<" "<<r+1<<"\n";
                l++,l%=n;
                r+=n-1,r%=n;
                if(!r)r=n-1;
                if(!l)l=1;
            }
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

3

output:

2 3
3 1
1 2

result:

wrong answer Integer 1 violates the range [4, 3]