QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#350073#8215. Isomorphic Delightwillow#WA 1ms3888kbC++172.0kb2024-03-10 13:44:532024-03-10 13:44:54

Judging History

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

  • [2024-03-10 13:44:54]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3888kb
  • [2024-03-10 13:44:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n, tot, rd[6][6], id[6];
pair<int, int> e[15];
int main() {
    scanf("%d", &n);
    if(n == 1) {
        puts("YES\n0");
    }
    else if(n <= 4) {
        puts("NO");
    }
    else if(n == 5) {
        puts("NO");
        return 0;
        for(int i = 1; i <= 5; ++ i) {
            for(int j = i + 1; j <= 5; ++ j) {
                e[tot ++] = {i, j};
            }
        }
        int w = 0;
        for(int i = 0; i < 1 << tot; ++ i) {
            for(int j = 0; j < tot; ++ j) {
                auto [u, v] = e[j];
                rd[u][v] = rd[v][u] = (i >> j & 1);
            }
            for(int j = 1; j <= 5; ++ j) {
                id[j] = j;
            }
            int cnt = 0;
            do {
                int flg = 1;
                for(int j = 1; j <= 5 && flg; ++ j) {
                    for(int k = 1; k <= 5; ++ k) {
                        if(rd[j][k] != rd[id[j]][id[k]]) {
                            flg = 0;
                            break;
                        }
                    }
                }
                cnt += flg;
            }while(next_permutation(id + 1, id + 6));
            if(cnt == 1) {
                w = 1;
                puts("YES");
                printf("%d\n", __builtin_popcount(i));
                for(int j = 0; j < tot; ++ j) {
                    auto [u, v] = e[j];
                    if(i >> j & 1) {
                        printf("%d %d\n", u, v);
                    }
                }
                break;
            }
        }
        if(!w)
            puts("NO");
    }
    else if(n == 6) {
        puts("YES\n6\n1 2\n2 3\n1 3\n3 4\n2 5\n5 6");
    }
    else {
        puts("YES");
        printf("%d\n", n - 1);
        puts("1 2");
        puts("1 3");
        puts("3 4");
        puts("1 5");
        for(int i = 6; i <= n; ++ i) {
            printf("%d %d\n", i - 1, i);
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3764kb

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

score: 0
Accepted
time: 1ms
memory: 3664kb

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

input:

4

output:

NO

result:

ok Everything ok

Test #4:

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

input:

2

output:

NO

result:

ok Everything ok

Test #5:

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

input:

3

output:

NO

result:

ok Everything ok

Test #6:

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

input:

5

output:

NO

result:

ok Everything ok

Test #7:

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

input:

7

output:

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

result:

ok Everything ok

Test #8:

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

input:

8

output:

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

result:

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