QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84134 | #5528. Least Annoying Constructive Problem | kkio | WA | 2ms | 3700kb | C++14 | 531b | 2023-03-05 19:06:59 | 2023-03-05 19:07:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n;
int calc(int x){return (x-1)%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=i,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=i,v=calc(i+j);
if(u>v)swap(u,v);
printf("%d %d\n",u,v);
}
printf("%d %d\n",i,n+1);
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3512kb
input:
3
output:
1 2 2 3 1 3
result:
ok Correct
Test #2:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
4
output:
1 2 1 4 2 3 2 4 1 3 3 4
result:
ok Correct
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3700kb
input:
5
output:
1 2 1 3 2 3 2 4 3 4 3 5 4 5 1 4 1 5 2 5
result:
wrong answer Every consecutive n-1 edges have to form a tree, false for 0