QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#425945#5528. Least Annoying Constructive ProblemDiuWA 0ms3948kbC++14580b2024-05-30 19:26:162024-05-30 19:26:17

Judging History

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

  • [2024-05-30 19:26:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3948kb
  • [2024-05-30 19:26:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
void prt1(int u,int v){
	u=(u%n+n)%n+1,v=(v%n+n)%n+1;
	if(u>v)swap(u,v);
	printf("%d %d\n",u,v);
}
void prt2(int u,int v){
	if(u>v)swap(u,v);
	printf("%d %d\n",u,v);
}
signed main(){
	scanf("%d",&n);
	if(n&1){
		for(int i=0;i<=n/2;i++){
			for(int j=1;j<=n/2;j++)prt1(j-i,n-j+1-i);
			if(i==n/2)break;
			for(int j=1;j<=n/2;j++)prt1(j-i,n-j-i);
		}
	}else{
		for(int i=1;i<n;i++){
			prt2(i,n);
			for(int j=i+1,k=i-1,l=1;l<n/2;l++){
				if(j==n)j=1;
				if(k==0)k=n-1;
				prt2(j,k);
			}
		}
	}
}

詳細信息

Test #1:

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

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

4

output:

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

result:

ok Correct

Test #3:

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

input:

5

output:

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

result:

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