QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394816 | #7756. Omniscia Spares None | chenyitaoooo | WA | 1ms | 3956kb | C++14 | 1.3kb | 2024-04-20 19:57:35 | 2024-04-20 19:57:36 |
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,0,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: 1ms
memory: 3948kb
input:
3
output:
Yes 1 1 1 2 1 3 0
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
4
output:
Yes 1 1 1 2 1 3 1 4 0
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
1
output:
Yes 1 1 0
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
2
output:
Yes 1 1 1 2 0
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
6
output:
No
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3880kb
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: 1ms
memory: 3888kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
10
output:
Yes -1 0 0 1 1 0 0 -1 -50025 10005 0 10 10005 50025 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:
ok OK, Accepted.
Test #11:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
11
output:
No
result:
ok OK, Accepted.
Test #12:
score: 0
Accepted
time: 1ms
memory: 3920kb
input:
12
output:
Yes -1 0 0 1 1 0 0 -1 -5 0 0 5 5 0 0 -5 -12 0 10005 70035 12 0 10005 -80040 30 1 2 2 3 3 4 4 1 5 6 6 7 7 8 8 5 9 10 10 11 11 12 12 9 1 3 1 5 2 6 3 7 4 8 1 6 3 6 1 8 3 8 5 9 6 10 7 11 8 12 5 10 7 10 5 12 7 12 10 12
result:
ok OK, Accepted.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
13
output:
No
result:
ok OK, Accepted.
Test #14:
score: -100
Wrong Answer
time: 1ms
memory: 3912kb
input:
14
output:
Yes -1 0 0 1 1 0 0 -1 -5 0 0 5 5 0 0 -5 -50025 10005 0 14 10005 50025 0 -14 0 28 0 -28 36 1 2 2 3 3 4 4 1 5 6 6 7 7 8 8 5 9 10 10 11 11 12 12 9 1 3 1 5 2 6 3 7 4 8 1 6 3 6 1 8 3 8 5 9 6 10 7 11 8 12 5 10 7 10 5 12 7 12 14 12 14 9 14 11 13 10 13 9 13 11 11 9
result:
wrong answer Invalid Planar Graph : segments (6, 7) and (11, 12) intersect