QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321846 | #8215. Isomorphic Delight | yyyyxh | WA | 0ms | 3684kb | C++23 | 837b | 2024-02-05 18:01:11 | 2024-02-05 18:01:13 |
Judging History
answer
#include <cstdio>
using namespace std;
const int N=1000003;
int n;
int su[N],sv[N],tp;
void add(int u,int v){++tp;su[tp]=u;sv[tp]=v;}
int main(){
scanf("%d",&n);
if(n==1){
puts("YES");
puts("0");
return 0;
}
if(n<=5){
puts("NO");
return 0;
}
if(n==6){
puts("YES");
puts("6");
puts("1 2");
puts("2 3");
puts("1 3");
puts("3 4");
puts("2 5");
puts("5 6");
return 0;
}
if(n==7){
puts("YES");
printf("%d\n",n-1);
for(int i=2;i<n;++i) printf("%d %d\n",i-1,i);
printf("3 %d\n",n);
return 0;
}
puts("YES");
--n;
for(int i=7;i<=n;++i)
if(i>n) break;
else{
for(int j=2;j<i;++j) add(n-i+j-1,n-i+j);
add(n-3,n);
n-=i;
}
while(n) add(n,n+1),--n;
printf("%d\n",tp);
for(int i=1;i<=tp;++i) printf("%d %d\n",su[i],sv[i]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1480kb
input:
1
output:
YES 0
result:
ok Everything ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 1352kb
input:
6
output:
YES 6 1 2 2 3 1 3 3 4 2 5 5 6
result:
ok Everything ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 1472kb
input:
4
output:
NO
result:
ok Everything ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 1484kb
input:
2
output:
NO
result:
ok Everything ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 1496kb
input:
3
output:
NO
result:
ok Everything ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 1472kb
input:
5
output:
NO
result:
ok Everything ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
7
output:
YES 6 1 2 2 3 3 4 4 5 5 6 3 7
result:
ok Everything ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
8
output:
YES 6 1 2 2 3 3 4 4 5 5 6 4 7
result:
ok Everything ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
9
output:
YES 7 2 3 3 4 4 5 5 6 6 7 5 8 1 2
result:
ok Everything ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
10
output:
YES 8 3 4 4 5 5 6 6 7 7 8 6 9 2 3 1 2
result:
ok Everything ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
11
output:
YES 9 4 5 5 6 6 7 7 8 8 9 7 10 3 4 2 3 1 2
result:
ok Everything ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
12
output:
YES 10 5 6 6 7 7 8 8 9 9 10 8 11 4 5 3 4 2 3 1 2
result:
ok Everything ok
Test #13:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
13
output:
YES 11 6 7 7 8 8 9 9 10 10 11 9 12 5 6 4 5 3 4 2 3 1 2
result:
ok Everything ok
Test #14:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
14
output:
YES 12 7 8 8 9 9 10 10 11 11 12 10 13 6 7 5 6 4 5 3 4 2 3 1 2
result:
ok Everything ok
Test #15:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
15
output:
YES 13 8 9 9 10 10 11 11 12 12 13 11 14 7 8 6 7 5 6 4 5 3 4 2 3 1 2
result:
ok Everything ok
Test #16:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
16
output:
YES 13 9 10 10 11 11 12 12 13 13 14 12 15 1 2 2 3 3 4 4 5 5 6 6 7 5 8
result:
ok Everything ok
Test #17:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
17
output:
YES 14 10 11 11 12 12 13 13 14 14 15 13 16 2 3 3 4 4 5 5 6 6 7 7 8 6 9 1 2
result:
ok Everything ok
Test #18:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
18
output:
YES 15 11 12 12 13 13 14 14 15 15 16 14 17 3 4 4 5 5 6 6 7 7 8 8 9 7 10 2 3 1 2
result:
ok Everything ok
Test #19:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
19
output:
YES 16 12 13 13 14 14 15 15 16 16 17 15 18 4 5 5 6 6 7 7 8 8 9 9 10 8 11 3 4 2 3 1 2
result:
ok Everything ok
Test #20:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
598
output:
YES 569 591 592 592 593 593 594 594 595 595 596 594 597 583 584 584 585 585 586 586 587 587 588 588 589 587 590 574 575 575 576 576 577 577 578 578 579 579 580 580 581 579 582 564 565 565 566 566 567 567 568 568 569 569 570 570 571 571 572 570 573 553 554 554 555 555 556 556 557 557 558 558 559 559 ...
result:
wrong answer contestant's solution is worse (more edges) than jury's