QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84487#5528. Least Annoying Constructive ProblemPdw2007WA 2ms3656kbC++14729b2023-03-06 15:21:442023-03-06 15:23:18

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-06 15:23:18]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3656kb
  • [2023-03-06 15:21:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
void calc(int x,int y) {
    x=(x+2*n-1)%n+1,y=(y+2*n-1)%n+1;
    if(x>y) swap(x,y);
    printf("%d %d\n",x,y);
    return;
}
namespace sub0{
    void koishi() {
        for(int i=1;i<n;i++) {
            printf("%d %d\n",i,n);
            for(int j=0;j<(n/2)-1;j++) {
                calc(i-j,i+1+j);
            }
        }
        return;
    }
}
namespace sub1{
    void koishi() {
        for(int i=1;i<=n;i++) {
            for(int j=0;j<(n/2);j++) {
                calc(i-j,i+1+j);
            }
        }
        return;
    }
}
int main() {
    scanf("%d",&n);
    if(n%2==0) sub0::koishi();
    else sub1::koishi();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3652kb

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3656kb

input:

4

output:

1 4
1 2
2 4
2 3
3 4
3 4

result:

wrong answer All edges have to be different