QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#578448 | #5528. Least Annoying Constructive Problem | HuTao | WA | 0ms | 3880kb | C++14 | 876b | 2024-09-20 19:17:55 | 2024-09-20 19:17:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int M = 1 << 18 | 5;
int n;
pair<int, int> e[M];
int main()
{
scanf("%d", &n);
int c = 0;
if(n & 1)
{
for(int i = 1; i <= n / 2; i ++ ) e[ ++ c] = make_pair(i + 0, n + 1 - i);
for(int i = 1; i <= n / 2; i ++ ) e[ ++ c] = make_pair(i + 1, n + 1 - i);
}
else
{
for(int i = 1; i < n / 2; i ++ ) e[ ++ c] = make_pair(i, n + 0 - i);
for(int i = 1; i <= n / 2; i ++ ) e[ ++ c] = make_pair(i, n + 1 - i);
}
for(int i = n; i <= n * (n - 1) / 2; i ++ )
{
e[i] = e[i - n + 1];
if(e[i].first <= n) e[i].first = e[i].first % n + 1;
if(e[i].second <= n) e[i].second = e[i].second % n + 1;
}
for(int i = 1; i <= n * (n - 1) / 2; i ++ ) printf("%d %d\n", e[i].first, e[i].second);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
input:
3
output:
1 3 2 3 2 1
result:
wrong answer Integer 1 violates the range [3, 3]