QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#346851#5528. Least Annoying Constructive Problemucup-team134WA 0ms3812kbC++17555b2024-03-09 03:06:202024-03-09 03:06:22

Judging History

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

  • [2024-03-09 03:06:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3812kb
  • [2024-03-09 03:06:20]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int n;
int add(int a,int b){
	a+=b;
	a%=n;
	if(a<0)a+=n;
	if(a==0)a=n;
	return a;
}
void Edge(int u,int v){
	if(u>v)swap(u,v);
	printf("%i %i\n",u,v);
}
int main(){
	scanf("%i",&n);
	if(n%2==1){
		for(int i=1;i<=n;i++){
			for(int j=0;j<n/2;j++){
				Edge(add(i,-j),add(i,j+1));
			}
		}
	}else{
		for(int i=1;i<=n/2;i++){
			for(int j=0;j<n/2;j++){
				Edge(add(i,-j),add(i,j+1));
			}
			for(int j=0;j<n/2-1;j++){
				Edge(add(i,-j),add(i,j+2));
			}
		}
	}
	return 0;
}

詳細信息

Test #1:

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

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3796kb

input:

4

output:

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

result:

wrong answer Every consecutive n-1 edges have to form a tree, false for 4