QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84667#5528. Least Annoying Constructive ProblemKaiserWilheimWA 2ms3552kbC++14613b2023-03-06 16:42:402023-03-06 16:42:43

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

answer

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3552kb

input:

3

output:

1 2
2 3
3 1

result:

wrong answer Integer 1 violates the range [4, 3]