QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394814 | #7756. Omniscia Spares None | chenyitaoooo | WA | 0ms | 3976kb | C++14 | 1.3kb | 2024-04-20 19:55:50 | 2024-04-20 19:55:51 |
Judging History
answer
#include<bits/stdc++.h>
#define Ri register int
using namespace std;
const int N=10005;
int from[N],to[N],tot,n;
void add(int u,int v){
from[++tot]=u,to[tot]=v;
}
void outb(){
printf("%d\n",tot);
for(Ri i=1; i<=tot; ++i) printf("%d %d\n",from[i],to[i]);
}
int main(){
scanf("%d",&n);
if(n<=4){
printf("Yes\n");
for(Ri i=1; i<=n; ++i) printf("%d %d\n",1,i);
printf("0\n");
return 0;
}
if(n<=6 || n%2==1){
printf("No\n");
return 0;
}
printf("Yes\n");
int nn=n/4*4;
for(Ri i=1; i<=nn; i+=4){
add(i,i+1),add(i+1,i+2),add(i+2,i+3),add(i+3,i);
}
add(1,3);
for(Ri i=1; i<=nn-4; i+=4){
add(i,i+4),add(i+1,i+5),add(i+2,i+6),add(i+3,i+7);
add(i,i+5),add(i+2,i+5),add(i,i+7),add(i+2,i+7);
}
if(n%4==0){
add(n-2,n);
for(Ri i=1; i<=n-4; i+=4){
printf("%d %d\n%d %d\n%d %d\n%d %d\n",-i,0,0,i,i,0,0,-i);
}
printf("%d %d\n%d %d\n%d %d\n%d %d\n",-n,0,N,N+N+N+N+N+N+N,n,0,N,-N-N-N-N-N-N-N-N);
outb();
return 0;
}
else{
add(n,n-2),add(n,n-5),add(n,n-3);
add(n-1,n-4),add(n-1,n-5),add(n-1,n-3);
add(n-3,n-5);
for(Ri i=1; i<=n-8; i+=4){
printf("%d %d\n%d %d\n%d %d\n%d %d\n",-i,0,0,i,i,0,0,-i);
}
printf("%d %d\n%d %d\n%d %d\n%d %d\n%d %d\n%d %d\n",-N,N+N+N+N+N+N+N+N+N+N,0,n,N,N+N+N+N+N+N+N+N,0,-n,0,n+n,0,-n-n);
outb();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3792kb
input:
3
output:
Yes 1 1 1 2 1 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
4
output:
Yes 1 1 1 2 1 3 1 4 0
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
1
output:
Yes 1 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
2
output:
Yes 1 1 1 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
8
output:
Yes -1 0 0 1 1 0 0 -1 -8 0 10005 70035 8 0 10005 -80040 18 1 2 2 3 3 4 4 1 5 6 6 7 7 8 8 5 1 3 1 5 2 6 3 7 4 8 1 6 3 6 1 8 3 8 6 8
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3912kb
input:
10
output:
Yes -1 0 0 1 1 0 0 -1 -10005 100050 0 10 10005 80040 0 -10 0 20 0 -20 24 1 2 2 3 3 4 4 1 5 6 6 7 7 8 8 5 1 3 1 5 2 6 3 7 4 8 1 6 3 6 1 8 3 8 10 8 10 5 10 7 9 6 9 5 9 7 7 5
result:
wrong answer Invalid Planar Graph : segments (1, 2) and (8, 5) intersect