QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#104064#6379. LaLa and Monster Hunting (Part 2)chenshiWA 1917ms6508kbC++2.2kb2023-05-08 14:22:442023-05-08 14:22:48

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-08 14:22:48]
  • 评测
  • 测评结果:WA
  • 用时:1917ms
  • 内存:6508kb
  • [2023-05-08 14:22:44]
  • 提交

answer

#include<cstdio>
using namespace std;
const int o=2e5+10,MOD=998244353;
int n,m,u[o],v[o],h[o],cnt=1,deg[o],H[o],Cnt,a[o],b[o],c[o],d[o],f[o],g,l[o],p[o],st[o],tp,col[o],id[o],asd,ans;
struct Edge{int v,p;}e[o],E[o];
inline void ad(int U,int V){e[++cnt].v=V;e[cnt].p=h[U];h[U]=cnt;}
inline void Ad(int U,int V){E[++Cnt].v=V;E[Cnt].p=H[U];H[U]=Cnt;}
inline bool cmp(int x,int y){if(deg[x]^deg[y]) return deg[x]<deg[y];return x<y;}
inline void calc(int x,int u,int y){
	int t;
	t=x*2+(e[x*2].v==u);c[t]=(c[t]+b[y]-1ll+MOD)%MOD;
	t=y*2+(e[y*2].v==u);c[t]=(c[t]+b[x]-1ll+MOD)%MOD;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i) scanf("%d%d",&u[i],&v[i]),ad(++u[i],++v[i]),ad(v[i],u[i]),++deg[u[i]],++deg[v[i]];
	for(int i=1;i<=m;++i) if(cmp(u[i],v[i])) Ad(u[i],v[i]);else Ad(v[i],u[i]);
	for(int i=1;i<=m;++i){
		++asd;
		for(int j=H[u[i]];j;j=E[j].p) col[E[j].v]=asd,id[E[j].v]=j;
		for(int j=H[v[i]];j;j=E[j].p) if(col[E[j].v]==asd)
			++a[u[i]],++a[v[i]],++a[E[j].v],++b[i],++b[j],++b[id[E[j].v]];
	}
	for(int i=1;i<=m;++i){
		++asd;
		for(int j=H[u[i]];j;j=E[j].p) col[E[j].v]=asd,id[E[j].v]=j;
		for(int j=H[v[i]];j;j=E[j].p) if(col[E[j].v]==asd)
			calc(i,v[i],j),calc(j,E[j].v,id[E[j].v]),calc(id[E[j].v],u[i],i);
	}
	for(int i=1;i<=m;++i)
		d[u[i]]=((d[u[i]]+a[v[i]])%MOD+MOD-b[i])%MOD,d[v[i]]=((d[v[i]]+a[u[i]])%MOD+MOD-b[i])%MOD;
	for(int i=1;i<=n;++i) for(int j=h[i];j;j=e[j].p)
		f[i]=(f[i]+0ll+d[e[j].v]+MOD-(a[i]+MOD-b[j/2])%MOD+MOD-c[j])%MOD;
	for(int i=1;i<=n;++i) for(int j=h[i];j;j=e[j].p) ans=(ans+f[e[j].v]);
	for(int i=1;i<=n;++i) ans=(ans+MOD-f[i])%MOD;
	for(int i=1;i<=n;++i) g=(g+a[i]*(a[i]-1ll)/2)%MOD;
	for(int i=1;i<=m;++i) g=(g+(MOD-b[i])*(b[i]-1ll))%MOD;
	ans=(ans+(MOD-g)*4ll)%MOD;
	for(int i=1;i<=n;++i){
		for(int j=h[i];j;j=e[j].p) for(int k=H[e[j].v];k;k=E[k].p)
			if(cmp(i,E[k].v)) if(!l[E[k].v]++) st[++tp]=E[k].v;
		for(int j=h[i];j;j=e[j].p) for(int k=H[e[j].v];k;k=E[k].p)
			if(cmp(i,E[k].v)) p[j/2]=(p[j/2]+l[E[k].v]-1)%MOD,p[k]=(p[k]+l[E[k].v]-1)%MOD;
		for(;tp;l[st[tp--]]=0);
	}
	g=0;
	for(int i=1;i<=m;++i) g=(g+b[i]*(b[i]-1ll)/2)%MOD; 
	g=(MOD-g)*4ll%MOD;
	for(int i=1;i<=m;++i) g=(g+p[i]*1ll*b[i])%MOD;
	ans=(ans+(MOD-g)*2ll)%MOD;
	printf("%d",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

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

output:

360

result:

ok 1 number(s): "360"

Test #3:

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

input:

2 0

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

2 0

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

3 3
1 2
0 2
0 1

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

3 2
0 1
0 2

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

3 2
0 2
0 1

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

3 3
0 1
0 2
1 2

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

3 0

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

3 3
0 2
0 1
1 2

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #16:

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

input:

4 3
2 3
1 2
0 2

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

4 1
2 3

output:

0

result:

ok 1 number(s): "0"

Test #18:

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

input:

4 3
2 3
1 2
0 3

output:

0

result:

ok 1 number(s): "0"

Test #19:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

4 4
2 3
0 3
1 3
0 2

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

5 3
2 4
2 3
1 3

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #27:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #28:

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

input:

6 14
0 4
2 5
1 3
1 4
1 5
4 5
2 4
0 5
0 3
3 5
1 2
0 2
3 4
2 3

output:

216

result:

ok 1 number(s): "216"

Test #29:

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

input:

6 3
2 5
0 2
2 3

output:

0

result:

ok 1 number(s): "0"

Test #30:

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

input:

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

output:

360

result:

ok 1 number(s): "360"

Test #31:

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

input:

6 14
4 5
2 5
2 4
2 3
0 2
3 5
1 3
1 5
1 2
1 4
0 4
3 4
0 5
0 3

output:

216

result:

ok 1 number(s): "216"

Test #32:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #33:

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

input:

7 20
2 6
0 2
1 6
1 5
3 5
2 4
0 4
4 6
0 1
2 5
3 6
2 3
4 5
1 2
1 3
0 3
0 5
1 4
5 6
0 6

output:

1800

result:

ok 1 number(s): "1800"

Test #34:

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

input:

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

output:

16

result:

ok 1 number(s): "16"

Test #35:

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

input:

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

output:

26

result:

ok 1 number(s): "26"

Test #36:

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

input:

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

output:

2

result:

ok 1 number(s): "2"

Test #37:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #38:

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

input:

7 20
4 6
2 6
2 5
0 2
1 4
3 6
3 4
3 5
2 3
5 6
1 3
4 5
1 6
1 5
0 5
1 2
0 1
0 3
0 4
2 4

output:

1800

result:

ok 1 number(s): "1800"

Test #39:

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

input:

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

output:

478

result:

ok 1 number(s): "478"

Test #40:

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

input:

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

output:

6144

result:

ok 1 number(s): "6144"

Test #41:

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

input:

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

output:

4716

result:

ok 1 number(s): "4716"

Test #42:

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

input:

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

output:

220

result:

ok 1 number(s): "220"

Test #43:

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

input:

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

output:

121

result:

ok 1 number(s): "121"

Test #44:

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

input:

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

output:

163

result:

ok 1 number(s): "163"

Test #45:

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

input:

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

output:

74

result:

ok 1 number(s): "74"

Test #46:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #47:

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

input:

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

output:

1577

result:

ok 1 number(s): "1577"

Test #48:

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

input:

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

output:

48

result:

ok 1 number(s): "48"

Test #49:

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

input:

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

output:

9141

result:

ok 1 number(s): "9141"

Test #50:

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

input:

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

output:

25200

result:

ok 1 number(s): "25200"

Test #51:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #52:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #53:

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

input:

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

output:

17948

result:

ok 1 number(s): "17948"

Test #54:

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

input:

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

output:

56400

result:

ok 1 number(s): "56400"

Test #55:

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

input:

10 12
3 8
5 7
2 4
3 6
6 7
5 6
3 7
7 9
0 9
0 2
2 9
2 8

output:

20

result:

ok 1 number(s): "20"

Test #56:

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

input:

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

output:

65520

result:

ok 1 number(s): "65520"

Test #57:

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

input:

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

output:

360

result:

ok 1 number(s): "360"

Test #58:

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

input:

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

output:

2520

result:

ok 1 number(s): "2520"

Test #59:

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

input:

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

output:

10080

result:

ok 1 number(s): "10080"

Test #60:

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

input:

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

output:

30240

result:

ok 1 number(s): "30240"

Test #61:

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

input:

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

output:

75600

result:

ok 1 number(s): "75600"

Test #62:

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

input:

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

output:

166320

result:

ok 1 number(s): "166320"

Test #63:

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

input:

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

output:

332640

result:

ok 1 number(s): "332640"

Test #64:

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

input:

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

output:

617760

result:

ok 1 number(s): "617760"

Test #65:

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

input:

14 91
8 13
10 12
0 3
4 9
1 2
4 7
5 6
3 12
7 10
0 1
8 9
2 13
0 12
2 3
9 10
4 5
10 13
7 9
9 11
7 13
1 11
3 5
7 11
1 7
0 5
0 11
2 5
0 13
3 4
2 12
1 4
3 6
6 11
6 9
5 12
4 13
0 2
3 9
2 10
8 12
7 8
9 12
1 3
4 6
6 7
0 8
6 10
5 7
11 13
2 6
3 13
0 6
7 12
11 12
6 13
1 9
4 10
1 6
0 10
0 9
3 8
10 11
1 8
6 8
2 4...

output:

1081080

result:

ok 1 number(s): "1081080"

Test #66:

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

input:

15 105
6 9
3 14
0 2
0 5
7 10
5 7
1 3
9 11
1 12
3 4
0 4
1 9
3 11
3 13
0 14
5 9
10 11
8 10
1 11
2 12
7 13
11 12
12 14
7 8
5 11
5 14
2 13
0 8
9 12
2 14
6 10
0 9
2 3
3 10
8 12
6 8
3 9
4 9
3 6
11 14
5 8
10 13
1 14
4 6
3 5
0 13
6 7
6 13
4 13
2 11
1 10
1 6
3 8
4 12
1 7
1 2
5 13
2 10
9 14
0 7
11 13
4 8
6 11...

output:

1801800

result:

ok 1 number(s): "1801800"

Test #67:

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

input:

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

output:

2882880

result:

ok 1 number(s): "2882880"

Test #68:

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

input:

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

output:

4455360

result:

ok 1 number(s): "4455360"

Test #69:

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

input:

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

output:

6683040

result:

ok 1 number(s): "6683040"

Test #70:

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

input:

19 171
8 15
11 17
1 12
6 13
4 11
3 17
5 6
1 16
1 3
0 17
3 14
9 10
2 5
6 12
5 9
0 13
1 7
14 16
0 4
0 11
12 15
12 13
5 8
2 11
11 14
11 13
11 16
7 16
13 18
2 3
7 15
1 9
1 5
5 10
16 17
0 7
9 11
3 12
13 15
0 10
7 9
4 18
1 8
1 10
0 18
6 9
1 11
9 17
2 17
6 7
3 11
8 18
11 15
8 10
0 5
13 17
1 2
6 14
3 4
4 16...

output:

9767520

result:

ok 1 number(s): "9767520"

Test #71:

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

input:

20 190
10 11
4 15
1 19
15 16
1 15
4 10
8 16
1 4
1 3
0 19
13 18
9 10
16 19
3 13
7 11
2 16
7 19
1 2
1 16
16 18
1 17
9 18
0 17
1 6
6 18
7 8
9 11
4 6
4 19
3 4
4 9
8 17
0 18
2 19
3 17
2 11
16 17
7 18
4 17
6 7
7 15
13 17
6 14
9 19
8 12
1 14
4 8
14 19
10 14
4 5
0 4
5 10
2 9
5 8
3 14
2 12
5 9
6 19
1 7
10 15...

output:

13953600

result:

ok 1 number(s): "13953600"

Test #72:

score: -100
Wrong Answer
time: 1917ms
memory: 6508kb

input:

420 87990
66 338
323 336
186 376
318 325
284 379
21 410
374 376
39 343
259 398
79 393
58 126
178 296
77 110
70 299
77 172
56 395
191 302
2 238
191 318
61 152
270 397
121 287
141 291
140 343
168 212
25 303
302 363
18 359
175 341
140 202
189 190
316 339
299 396
129 280
119 224
110 279
190 418
306 417
...

output:

942437644

result:

wrong answer 1st numbers differ - expected: '405528396', found: '942437644'