QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#329932#7412. Counting CactusSoyTonyAC ✓810ms11960kbC++144.3kb2024-02-17 09:10:552024-02-17 09:10:55

Judging History

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

  • [2024-02-17 09:10:55]
  • 评测
  • 测评结果:AC
  • 用时:810ms
  • 内存:11960kb
  • [2024-02-17 09:10:55]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int maxn=(1<<13)+10;
const int mod=998244353;
const int inv2=499122177;

inline int read(){
    int x=0,w=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}
    while(c<='9'&&c>='0'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return x*w;
}

int n,m;
int E[15][15];
int f[maxn][15],g[maxn][15],h[maxn][15][15];
#define lowbit(x) (x&-x)
int main(){
    // freopen("stag.in","r",stdin);
    // freopen("stag.out","w",stdout);
    n=read(),m=read();
    for(int i=1;i<=m;++i){
        int u=read(),v=read();
        E[u][v]=E[v][u]=1;
    }
    for(int i=1;i<=n;++i) f[(1<<i-1)][i]=1;
    for(int s=1;s<(1<<n);++s){
        for(int u=1;u<=n;++u){
            if(!(s&(1<<u-1))) continue;
            // printf("***s:%d u:%d***\n",s,u);
            // printf("a\n");
            for(int v=1;v<=n;++v){
                if(u==v) continue;
                if(!(s&(1<<v-1))) continue;
                if(!E[u][v]) continue;
                for(int w=1;w<=n;++w){
                    if(u==w||v==w) continue;
                    if(!(s&(1<<w-1))) continue;
                    for(int t=s^(1<<v-1)^(1<<w-1);t;t=(t-1)&(s^(1<<v-1)^(1<<w-1))){
                        if(!(t&(1<<u-1))) continue;
                        int t1=t,t2=s^t1;
                        // printf("t1:%d t2:%d v:%d w:%d\n",t1,t2,v,w);
                        //链首增加一个仙人掌
                        h[s][u][w]=(h[s][u][w]+1ll*f[t1][u]*h[t2][v][w]%mod)%mod;
                    }
                }
            }
            // for(int v=1;v<=n;++v){
            //     if(s&(1<<v-1)) printf("(v=%d,h=%d) ",v,h[s][u][v]);
            // }
            // printf("\n");
            // printf("b\n");
            for(int v=1;v<=n;++v){
                if(u==v) continue;
                if(!(s&(1<<v-1))) continue;
                if(!E[u][v]) continue;
                for(int t=s^(1<<v-1);t;t=(t-1)&(s^(1<<v-1))){
                    if(!(t&(1<<u-1))) continue;
                    int t1=t,t2=s^t1;
                    // printf("t1:%d t2:%d\n",t1,t2);
                    //两个仙人掌合成一个新链
                    h[s][u][v]=(h[s][u][v]+1ll*f[t1][u]*f[t2][v]%mod)%mod;
                }
            }
            // for(int v=1;v<=n;++v){
            //     if(s&(1<<v-1)) printf("(v=%d,h=%d) ",v,h[s][u][v]);
            // }
            // printf("\n");
            // printf("c\n");
            for(int v=1;v<=n;++v){
                if(u==v) continue;
                if(!(s&(1<<v-1))) continue;
                if(!E[u][v]) continue;
                for(int w=v+1;w<=n;++w){
                    if(!(s&(1<<w-1))) continue;
                    if(!E[u][w]) continue;
                    // printf("v:%d w:%d\n",v,w);
                    g[s][u]=(g[s][u]+h[s^(1<<u-1)][v][w])%mod;
                    // for(int t=s^(1<<v-1)^(1<<w-1);t;t=(t-1)&(s^(1<<v-1)^(1<<w-1))){
                    //     if(!(t&(1<<u-1))) continue;
                    //     int t1=t,t2=s^t1;
                    //     printf("t1:%d t2:%d v:%d w:%d\n",t1,t2,v,w);
                    //     g[s][u]=(g[s][u]+1ll*f[t1][u]*h[t2][v][w])%mod;
                    // }
                }
            }
            // printf("f:%d g:%d\n",f[s][u],g[s][u]);
            // printf("d\n");
            if(s!=(1<<u-1)){
                int v=__lg(lowbit((s^(1<<u-1))))+1;
                // printf("v:%d\n",v);
                for(int t=s^(1<<v-1);t;t=(t-1)&(s^(1<<v-1))){
                    if(!(t&(1<<u-1))) continue;
                    int t1=t,t2=s^t1;
                    // printf("t1:%d t2:%d\n",t1,t2);
                    f[s][u]=(f[s][u]+1ll*f[t1][u]*g[t2|(1<<u-1)][u]%mod);
                    // printf("f:%d\n",f[s][u]);
                    for(int w=1;w<=n;++w){
                        if(!(t2&(1<<w-1))) continue;
                        if(!E[u][w]) continue;
                        // printf("w:%d\n",w);
                        f[s][u]=(f[s][u]+1ll*f[t1][u]*f[t2][w]%mod)%mod;
                    }
                    // printf("f:%d\n",f[s][u]);
                }
            }
            // printf("f:%d g:%d\n",f[s][u],g[s][u]);
        }
    }
    printf("%d\n",f[(1<<n)-1][1]);
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

3 3
1 2
2 3
3 1

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

5 0

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

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

output:

35

result:

ok 1 number(s): "35"

Test #4:

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

input:

6 8
5 6
2 5
3 5
1 5
1 2
3 4
1 6
1 3

output:

38

result:

ok 1 number(s): "38"

Test #5:

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

input:

1 0

output:

1

result:

ok 1 number(s): "1"

Test #6:

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

input:

2 0

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

2 1
1 2

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

3 0

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

3 1
2 3

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

3 2
1 2
2 3

output:

1

result:

ok 1 number(s): "1"

Test #11:

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

input:

3 3
1 2
1 3
2 3

output:

4

result:

ok 1 number(s): "4"

Test #12:

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

input:

4 0

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

4 1
1 4

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

4 2
1 4
1 2

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

4 3
1 3
2 3
2 4

output:

1

result:

ok 1 number(s): "1"

Test #16:

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

input:

4 4
2 3
2 4
3 4
1 3

output:

4

result:

ok 1 number(s): "4"

Test #17:

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

input:

4 5
2 3
2 4
1 3
3 4
1 2

output:

13

result:

ok 1 number(s): "13"

Test #18:

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

input:

4 6
3 4
1 2
1 3
2 3
1 4
2 4

output:

31

result:

ok 1 number(s): "31"

Test #19:

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

input:

5 1
2 3

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

5 2
1 3
1 2

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

5 3
2 4
3 4
1 5

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

5 4
3 5
4 5
2 3
3 4

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

5 5
1 5
4 5
3 5
1 3
2 4

output:

4

result:

ok 1 number(s): "4"

Test #24:

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

input:

5 6
1 5
4 5
1 4
2 3
1 3
3 5

output:

13

result:

ok 1 number(s): "13"

Test #25:

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

input:

5 7
4 5
2 4
2 3
1 5
1 3
1 2
2 5

output:

41

result:

ok 1 number(s): "41"

Test #26:

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

input:

5 8
4 5
2 3
3 5
1 2
2 4
2 5
1 4
1 5

output:

90

result:

ok 1 number(s): "90"

Test #27:

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

input:

5 9
4 5
1 4
1 5
1 2
3 5
2 4
2 5
1 3
3 4

output:

192

result:

ok 1 number(s): "192"

Test #28:

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

input:

5 10
2 4
1 5
2 5
1 4
2 3
3 4
1 2
3 5
4 5
1 3

output:

362

result:

ok 1 number(s): "362"

Test #29:

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

input:

6 1
1 5

output:

0

result:

ok 1 number(s): "0"

Test #30:

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

input:

6 3
3 4
3 5
2 6

output:

0

result:

ok 1 number(s): "0"

Test #31:

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

input:

6 4
4 5
4 6
5 6
1 3

output:

0

result:

ok 1 number(s): "0"

Test #32:

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

input:

6 6
4 5
2 6
2 5
5 6
1 6
2 3

output:

4

result:

ok 1 number(s): "4"

Test #33:

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

input:

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

output:

20

result:

ok 1 number(s): "20"

Test #34:

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

input:

6 9
2 3
5 6
4 5
1 6
1 5
4 6
1 4
3 4
2 4

output:

124

result:

ok 1 number(s): "124"

Test #35:

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

input:

6 10
2 6
2 3
3 5
1 6
2 4
1 4
1 5
3 6
5 6
4 6

output:

311

result:

ok 1 number(s): "311"

Test #36:

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

input:

6 12
1 4
2 3
4 6
1 3
2 4
3 5
1 5
1 6
3 6
5 6
3 4
2 5

output:

1150

result:

ok 1 number(s): "1150"

Test #37:

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

input:

6 13
3 6
3 5
1 6
1 4
1 3
3 4
4 6
2 5
1 2
4 5
2 3
2 6
2 4

output:

1956

result:

ok 1 number(s): "1956"

Test #38:

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

input:

6 15
5 6
3 6
2 5
1 5
3 4
2 3
3 5
1 4
2 4
1 2
4 5
1 3
2 6
4 6
1 6

output:

5676

result:

ok 1 number(s): "5676"

Test #39:

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

input:

7 2
1 5
1 4

output:

0

result:

ok 1 number(s): "0"

Test #40:

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

input:

7 4
1 2
3 4
2 4
2 7

output:

0

result:

ok 1 number(s): "0"

Test #41:

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

input:

7 6
1 7
2 3
6 7
1 4
4 6
3 6

output:

0

result:

ok 1 number(s): "0"

Test #42:

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

input:

7 8
4 6
6 7
3 4
5 7
1 7
1 5
1 4
1 3

output:

0

result:

ok 1 number(s): "0"

Test #43:

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

input:

7 10
1 5
1 6
2 7
5 6
4 7
3 5
2 3
4 6
1 3
4 5

output:

181

result:

ok 1 number(s): "181"

Test #44:

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

input:

7 12
1 2
1 3
5 7
4 6
3 7
2 3
2 6
4 7
3 5
1 6
2 5
4 5

output:

1039

result:

ok 1 number(s): "1039"

Test #45:

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

input:

7 14
1 6
2 7
1 5
1 2
2 6
3 7
3 6
1 3
1 4
3 5
1 7
6 7
4 5
2 4

output:

3604

result:

ok 1 number(s): "3604"

Test #46:

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

input:

7 16
2 3
5 7
2 6
1 2
1 5
2 7
3 7
1 3
6 7
1 4
3 5
1 6
4 6
4 5
4 7
1 7

output:

11282

result:

ok 1 number(s): "11282"

Test #47:

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

input:

7 18
4 6
2 6
1 2
1 7
1 6
3 6
3 4
6 7
3 7
1 3
5 7
3 5
2 5
2 4
2 3
4 5
1 4
5 6

output:

30712

result:

ok 1 number(s): "30712"

Test #48:

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

input:

7 21
2 3
4 5
6 7
1 6
3 6
5 6
1 5
2 7
5 7
1 7
4 6
4 7
2 5
2 4
3 4
3 5
1 4
1 3
1 2
3 7
2 6

output:

111982

result:

ok 1 number(s): "111982"

Test #49:

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

input:

8 2
7 8
4 5

output:

0

result:

ok 1 number(s): "0"

Test #50:

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

input:

8 5
4 6
3 8
3 6
1 6
1 7

output:

0

result:

ok 1 number(s): "0"

Test #51:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #52:

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

input:

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

output:

194

result:

ok 1 number(s): "194"

Test #53:

score: 0
Accepted
time: 2ms
memory: 6056kb

input:

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

output:

2234

result:

ok 1 number(s): "2234"

Test #54:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #55:

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

input:

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

output:

58357

result:

ok 1 number(s): "58357"

Test #56:

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

input:

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

output:

256740

result:

ok 1 number(s): "256740"

Test #57:

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

input:

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

output:

896236

result:

ok 1 number(s): "896236"

Test #58:

score: 0
Accepted
time: 2ms
memory: 4048kb

input:

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

output:

2666392

result:

ok 1 number(s): "2666392"

Test #59:

score: 0
Accepted
time: 2ms
memory: 6220kb

input:

9 3
2 4
4 6
3 8

output:

0

result:

ok 1 number(s): "0"

Test #60:

score: 0
Accepted
time: 2ms
memory: 4308kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #61:

score: 0
Accepted
time: 3ms
memory: 6296kb

input:

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

output:

22

result:

ok 1 number(s): "22"

Test #62:

score: 0
Accepted
time: 3ms
memory: 4364kb

input:

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

output:

1362

result:

ok 1 number(s): "1362"

Test #63:

score: 0
Accepted
time: 3ms
memory: 4284kb

input:

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

output:

30272

result:

ok 1 number(s): "30272"

Test #64:

score: 0
Accepted
time: 4ms
memory: 6284kb

input:

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

output:

231309

result:

ok 1 number(s): "231309"

Test #65:

score: 0
Accepted
time: 4ms
memory: 4248kb

input:

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

output:

1228756

result:

ok 1 number(s): "1228756"

Test #66:

score: 0
Accepted
time: 4ms
memory: 6268kb

input:

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

output:

4786715

result:

ok 1 number(s): "4786715"

Test #67:

score: 0
Accepted
time: 2ms
memory: 4316kb

input:

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

output:

20834784

result:

ok 1 number(s): "20834784"

Test #68:

score: 0
Accepted
time: 5ms
memory: 4312kb

input:

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

output:

74433564

result:

ok 1 number(s): "74433564"

Test #69:

score: 0
Accepted
time: 3ms
memory: 6800kb

input:

10 4
1 2
3 7
3 9
3 4

output:

0

result:

ok 1 number(s): "0"

Test #70:

score: 0
Accepted
time: 3ms
memory: 4820kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #71:

score: 0
Accepted
time: 9ms
memory: 4876kb

input:

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

output:

314

result:

ok 1 number(s): "314"

Test #72:

score: 0
Accepted
time: 7ms
memory: 6736kb

input:

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

output:

24203

result:

ok 1 number(s): "24203"

Test #73:

score: 0
Accepted
time: 11ms
memory: 6756kb

input:

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

output:

179906

result:

ok 1 number(s): "179906"

Test #74:

score: 0
Accepted
time: 12ms
memory: 4832kb

input:

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

output:

4779882

result:

ok 1 number(s): "4779882"

Test #75:

score: 0
Accepted
time: 13ms
memory: 4752kb

input:

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

output:

21599481

result:

ok 1 number(s): "21599481"

Test #76:

score: 0
Accepted
time: 14ms
memory: 4948kb

input:

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

output:

158052248

result:

ok 1 number(s): "158052248"

Test #77:

score: 0
Accepted
time: 15ms
memory: 4948kb

input:

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

output:

580117972

result:

ok 1 number(s): "580117972"

Test #78:

score: 0
Accepted
time: 16ms
memory: 4744kb

input:

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

output:

388090734

result:

ok 1 number(s): "388090734"

Test #79:

score: 0
Accepted
time: 11ms
memory: 5576kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #80:

score: 0
Accepted
time: 25ms
memory: 5828kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #81:

score: 0
Accepted
time: 28ms
memory: 5828kb

input:

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

output:

2730

result:

ok 1 number(s): "2730"

Test #82:

score: 0
Accepted
time: 34ms
memory: 7608kb

input:

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

output:

386280

result:

ok 1 number(s): "386280"

Test #83:

score: 0
Accepted
time: 38ms
memory: 7560kb

input:

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

output:

5294828

result:

ok 1 number(s): "5294828"

Test #84:

score: 0
Accepted
time: 39ms
memory: 7644kb

input:

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

output:

88388507

result:

ok 1 number(s): "88388507"

Test #85:

score: 0
Accepted
time: 47ms
memory: 5776kb

input:

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

output:

617514576

result:

ok 1 number(s): "617514576"

Test #86:

score: 0
Accepted
time: 51ms
memory: 7652kb

input:

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

output:

526165888

result:

ok 1 number(s): "526165888"

Test #87:

score: 0
Accepted
time: 54ms
memory: 5828kb

input:

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

output:

609348763

result:

ok 1 number(s): "609348763"

Test #88:

score: 0
Accepted
time: 53ms
memory: 5856kb

input:

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

output:

399515938

result:

ok 1 number(s): "399515938"

Test #89:

score: 0
Accepted
time: 57ms
memory: 9200kb

input:

12 6
1 7
3 8
4 12
5 9
1 5
8 11

output:

0

result:

ok 1 number(s): "0"

Test #90:

score: 0
Accepted
time: 82ms
memory: 7776kb

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #91:

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

input:

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

output:

19784

result:

ok 1 number(s): "19784"

Test #92:

score: 0
Accepted
time: 116ms
memory: 7864kb

input:

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

output:

3066577

result:

ok 1 number(s): "3066577"

Test #93:

score: 0
Accepted
time: 138ms
memory: 7872kb

input:

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

output:

130971576

result:

ok 1 number(s): "130971576"

Test #94:

score: 0
Accepted
time: 150ms
memory: 7816kb

input:

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

output:

458936620

result:

ok 1 number(s): "458936620"

Test #95:

score: 0
Accepted
time: 172ms
memory: 9544kb

input:

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

output:

364085127

result:

ok 1 number(s): "364085127"

Test #96:

score: 0
Accepted
time: 188ms
memory: 7808kb

input:

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

output:

634063285

result:

ok 1 number(s): "634063285"

Test #97:

score: 0
Accepted
time: 198ms
memory: 7748kb

input:

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

output:

472127797

result:

ok 1 number(s): "472127797"

Test #98:

score: 0
Accepted
time: 207ms
memory: 7848kb

input:

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

output:

907634918

result:

ok 1 number(s): "907634918"

Test #99:

score: 0
Accepted
time: 197ms
memory: 10512kb

input:

13 7
5 6
4 7
6 9
6 13
6 11
11 13
11 12

output:

0

result:

ok 1 number(s): "0"

Test #100:

score: 0
Accepted
time: 273ms
memory: 11948kb

input:

13 15
2 10
2 8
4 9
8 12
9 11
11 12
3 4
9 12
5 11
2 11
5 13
4 13
2 6
5 9
2 13

output:

0

result:

ok 1 number(s): "0"

Test #101:

score: 0
Accepted
time: 368ms
memory: 11936kb

input:

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

output:

303635

result:

ok 1 number(s): "303635"

Test #102:

score: 0
Accepted
time: 432ms
memory: 11860kb

input:

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

output:

72498331

result:

ok 1 number(s): "72498331"

Test #103:

score: 0
Accepted
time: 497ms
memory: 11936kb

input:

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

output:

870835596

result:

ok 1 number(s): "870835596"

Test #104:

score: 0
Accepted
time: 561ms
memory: 11936kb

input:

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

output:

348414352

result:

ok 1 number(s): "348414352"

Test #105:

score: 0
Accepted
time: 623ms
memory: 11960kb

input:

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

output:

605042354

result:

ok 1 number(s): "605042354"

Test #106:

score: 0
Accepted
time: 687ms
memory: 11888kb

input:

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

output:

52075121

result:

ok 1 number(s): "52075121"

Test #107:

score: 0
Accepted
time: 745ms
memory: 11904kb

input:

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

output:

109307024

result:

ok 1 number(s): "109307024"

Test #108:

score: 0
Accepted
time: 810ms
memory: 11948kb

input:

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

output:

805485853

result:

ok 1 number(s): "805485853"