QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#715050#8215. Isomorphic Delightucup-team5071#WA 0ms3848kbC++201.1kb2024-11-06 10:07:342024-11-06 10:07:36

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 10:07:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-11-06 10:07:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
void no(){
    cout<<"NO"<<endl;
    exit(0);
}
int main()
{
    int n;cin>>n;
    vector<pair<int,int>> ans;
    auto write = [&](){
        cout<<"YES\n"<<ans.size()<<"\n";
        for(auto [x,y]:ans)cout<<x<<" "<<y<<"\n";
        exit(0);
    };
    auto add = [&](int l,int r){
        ans.emplace_back(l,l+1);
        ans.emplace_back(l+1,l+2);
        ans.emplace_back(l+2,l+3);
        ans.emplace_back(l+2,l+4);
        for(int i=l+5;i<=r;i++)ans.emplace_back(i,i-1);
    };
    if(n>=2&&n<=5)no();
    if(n==6){
        ans.emplace_back(1,2);
        ans.emplace_back(2,3);
        ans.emplace_back(1,3);
        ans.emplace_back(3,4);
        ans.emplace_back(2,5);
        ans.emplace_back(5,6);
    }
    if(n==7){
        add(1,7);
    }
    if(n>7){
        n--;
        int now=0;
        for(int i=7;;i++){
            if(now+i<=n&&(n-(now+i))>=(i+1)){
                add(now+1,now+i);
                now+=i;
            }
            else {
                add(now+1,n);break;
            }
        }
    }
    write();
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

score: 0
Accepted
time: 0ms
memory: 3612kb

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: 3524kb

input:

4

output:

NO

result:

ok Everything ok

Test #4:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

2

output:

NO

result:

ok Everything ok

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

3

output:

NO

result:

ok Everything ok

Test #6:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

5

output:

NO

result:

ok Everything ok

Test #7:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

7

output:

YES
6
1 2
2 3
3 4
3 5
6 5
7 6

result:

ok Everything ok

Test #8:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

8

output:

YES
6
1 2
2 3
3 4
3 5
6 5
7 6

result:

ok Everything ok

Test #9:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

9

output:

YES
7
1 2
2 3
3 4
3 5
6 5
7 6
8 7

result:

ok Everything ok

Test #10:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

10

output:

YES
8
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8

result:

ok Everything ok

Test #11:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

11

output:

YES
9
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8
10 9

result:

ok Everything ok

Test #12:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

12

output:

YES
10
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8
10 9
11 10

result:

ok Everything ok

Test #13:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

13

output:

YES
11
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8
10 9
11 10
12 11

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

14

output:

YES
12
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12

result:

ok Everything ok

Test #15:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

15

output:

YES
13
1 2
2 3
3 4
3 5
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

16

output:

YES
13
1 2
2 3
3 4
3 5
6 5
7 6
8 9
9 10
10 11
10 12
13 12
14 13
15 14

result:

ok Everything ok

Test #17:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

17

output:

YES
14
1 2
2 3
3 4
3 5
6 5
7 6
8 9
9 10
10 11
10 12
13 12
14 13
15 14
16 15

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

18

output:

YES
15
1 2
2 3
3 4
3 5
6 5
7 6
8 9
9 10
10 11
10 12
13 12
14 13
15 14
16 15
17 16

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

19

output:

YES
16
1 2
2 3
3 4
3 5
6 5
7 6
8 9
9 10
10 11
10 12
13 12
14 13
15 14
16 15
17 16
18 17

result:

ok Everything ok

Test #20:

score: -100
Wrong Answer
time: 0ms
memory: 3556kb

input:

598

output:

YES
569
1 2
2 3
3 4
3 5
6 5
7 6
8 9
9 10
10 11
10 12
13 12
14 13
15 14
16 17
17 18
18 19
18 20
21 20
22 21
23 22
24 23
25 26
26 27
27 28
27 29
30 29
31 30
32 31
33 32
34 33
35 36
36 37
37 38
37 39
40 39
41 40
42 41
43 42
44 43
45 44
46 47
47 48
48 49
48 50
51 50
52 51
53 52
54 53
55 54
56 55
57 56
5...

result:

wrong answer contestant's solution is worse (more edges) than jury's