QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84469#5528. Least Annoying Constructive ProblemkkioWA 2ms3628kbC++14553b2023-03-06 15:16:062023-03-06 15:16:39

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:16:39]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3628kb
  • [2023-03-06 15:16:06]
  • 提交

answer

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

详细

Test #1:

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

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

score: 0
Accepted
time: 2ms
memory: 3496kb

input:

4

output:

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

result:

ok Correct

Test #3:

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

input:

5

output:

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

result:

ok Correct

Test #4:

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

input:

6

output:

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

result:

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