QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#84165#5528. Least Annoying Constructive Problemsinsop90WA 2ms3696kbC++14684b2023-03-05 20:39:292023-03-05 20:39:30

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-05 20:39:30]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3696kb
  • [2023-03-05 20:39:29]
  • 提交

answer

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

详细

Test #1:

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

input:

3

output:

1 2
2 3
1 3

result:

ok Correct

Test #2:

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

input:

4

output:

1 2
2 3
1 4
1 3

result:

wrong output format Unexpected end of file - int32 expected