QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#84135 | #5528. Least Annoying Constructive Problem | kkio | WA | 2ms | 3516kb | C++14 | 565b | 2023-03-05 19:10:43 | 2023-03-05 19:10:44 |
Judging History
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),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),v=calc(i+j);
if(u>v)swap(u,v);
printf("%d %d\n",u,v);
}
printf("%d %d\n",calc(i+1+(n-1)/2),n+1);
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3516kb
input:
3
output:
2 3 1 3 1 2
result:
ok Correct
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3516kb
input:
4
output:
2 3 3 4 1 3 1 4 1 2 2 4
result:
wrong answer Every consecutive n-1 edges have to form a tree, false for 1