UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#200608#3473. 欧拉回路jane10070ms1544kbC++11600b2024-01-07 09:57:262024-01-07 12:03:14

answer

#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
const int N=1e5+5;
int n,m,a[N];
long long count(long long cnt){
	long long res=1;
	while(cnt>1){
		res=res*cnt%MOD;
		cnt-=2;
	}
	return res;
}
int main(){
	scanf("%d%d",&n,&m);
	while(m--){
		int u,v;
		scanf("%d%d",&u,&v);
		a[u]++;
		a[v]++;
	}
	long long cnt=0;
	for(int i=1;i<=n;i++)
		if(a[i]%2==1)
			cnt++;
	if(cnt%2==0){
		long long ans=count(cnt-1);
		printf("%lld %lld\n",cnt/2,ans%MOD);
	}
	else{
		long long ans=count(cnt-2)*cnt;
		printf("%lld %lld\n",cnt/2+1,ans%MOD);
	}
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1192kb

input:

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

output:

1 1

result:

ok single line: '1 1'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

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

output:

2 3

result:

ok single line: '2 3'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

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

output:

1 1

result:

ok single line: '1 1'

Test #4:

score: 10
Accepted
time: 1ms
memory: 1192kb

input:

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

output:

2 3

result:

ok single line: '2 3'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1192kb

input:

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

output:

1 1

result:

ok single line: '1 1'

Test #6:

score: 10
Accepted
time: 18ms
memory: 1544kb

input:

90000 100000
86148 7841
35458 7841
22053 7841
72597 7841
46234 86148
66349 86148
84430 66349
13043 8...

output:

27374 895119460

result:

ok single line: '27374 895119460'

Test #7:

score: 10
Accepted
time: 14ms
memory: 1540kb

input:

90000 100000
31836 79514
63300 31836
66865 31836
32530 66865
11319 66865
83663 32530
44332 83663
278...

output:

27295 247300879

result:

ok single line: '27295 247300879'

Test #8:

score: 10
Accepted
time: 14ms
memory: 1540kb

input:

90000 100000
4273 50379
79924 50379
69076 4273
22163 79924
18129 50379
4652 18129
41333 22163
34378 ...

output:

27344 855444931

result:

ok single line: '27344 855444931'

Test #9:

score: 10
Accepted
time: 8ms
memory: 1544kb

input:

90000 100000
36888 28219
7060 36888
88192 28219
67345 88192
8034 7060
80465 8034
69104 28219
69828 7...

output:

27275 839765813

result:

ok single line: '27275 839765813'

Test #10:

score: 10
Accepted
time: 15ms
memory: 1384kb

input:

50000 100000
14562 47661
779 47661
31060 47661
37672 47661
3390 37672
1402 37672
12245 14562
27426 7...

output:

0 1

result:

ok single line: '0 1'

Extra Test:

score: 0
Extra Test Passed