QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84760#5528. Least Annoying Constructive ProblemAppleblue17WA 1ms3408kbC++14417b2023-03-06 18:23:152023-03-06 18:24:08

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 18:24:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3408kb
  • [2023-03-06 18:23:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=550;
int n;
void add(int x,int y){
	x=((x%n)+n)%n,y=(y%n+n)%n;
	if(x>y) swap(x,y);
	cout<<x+1<<" "<<y+1<<'\n';
}


int main(){
	cin>>n;
	if(n%2==1){
		for(int i=0;i<n;i++){
			for(int j=0;j<n/2;j++)
				add(i-j,i+1+j);
		}
	}
	else{
		for(int i=0;i<n-1;i++){
			for(int j=0;j<n/2-1;j++)
				add(i-1-j,i+1+j);
			add(i,i+n/2);
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3332kb

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3408kb

input:

4

output:

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

result:

wrong answer All edges have to be different