QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84513 | #5528. Least Annoying Constructive Problem | Pdw2007 | WA | 2ms | 3652kb | C++14 | 746b | 2023-03-06 15:32:49 | 2023-03-06 15:32:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
void calc(int x,int y) {
x=(x+2*n-1)%n+1,y=(y+2*n-1)%n+1;
if(x>y) swap(x,y);
printf("%d %d\n",x,y);
return;
}
namespace sub0{
void koishi() {
n--;
for(int i=1;i<=n;i++) {
printf("%d %d\n",i,n+1);
for(int j=0;j<(n/2);j++) {
calc(i-j+1,i+2+j);
}
}
return;
}
}
namespace sub1{
void koishi() {
for(int i=1;i<=n;i++) {
for(int j=0;j<(n/2);j++) {
calc(i-j,i+1+j);
}
}
return;
}
}
int main() {
scanf("%d",&n);
if(n%2==0) sub0::koishi();
else sub1::koishi();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3472kb
input:
3
output:
1 2 2 3 1 3
result:
ok Correct
Test #2:
score: 0
Accepted
time: 2ms
memory: 3436kb
input:
4
output:
1 4 2 3 2 4 1 3 3 4 1 2
result:
ok Correct
Test #3:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
5
output:
1 2 3 5 2 3 1 4 3 4 2 5 4 5 1 3 1 5 2 4
result:
ok Correct
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3652kb
input:
6
output:
1 6 2 3 1 4 2 6 3 4 2 5 3 6 4 5 1 3 4 6 1 5 2 4 5 6 1 2 3 5
result:
wrong answer Every consecutive n-1 edges have to form a tree, false for 0