QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#82618#5528. Least Annoying Constructive ProblemzhaohaikunWA 0ms3312kbC++141.0kb2023-02-28 14:31:512023-02-28 14:31:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-28 14:31:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3312kb
  • [2023-02-28 14:31:51]
  • 提交

answer

#include <bits/stdc++.h>
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n;
int calc(int x) {
	return (x + n - 1) % n + 1;
}
signed main() {
	cin >> n;
	if (n & 1) {
		int k = n / 2;
		F(i, 1, n) {
			F(j, 1, k) cout << calc(i - j + 1) << " " << calc(i + j) << endl;
		}
		return 0;
	}
	n--;
	int k = n / 2;
	F(i, 1, n - 1) {
		F(j, 1, k) cout << calc(i - j + 1) << " " << calc(i + j) << endl;
		cout << calc(i + k + 1) << " " << n + 1 << endl;
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3312kb

input:

3

output:

1 2
2 3
3 1

result:

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