QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209804#7107. ChaleurEznibuilRE 0ms5672kbC++14792b2023-10-10 17:39:212023-10-10 17:39:22

Judging History

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

  • [2023-10-10 17:39:22]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:5672kb
  • [2023-10-10 17:39:21]
  • 提交

answer

#pragma GCC optimize("Ofast,inline,no-stack-protector,unroll-loops")
#include<algorithm>
#include<iostream>
#include<numeric>
#include<vector>
int e[1000001],deg[1000001];
int main()
{
	std::cin.tie(nullptr)->sync_with_stdio(0);
	int t;
	std::cin>>t;
	while(t--)
	{
		int n,m;
		std::cin>>n>>m,std::fill_n(deg,n,0),std::iota(e,e+n,0);
		while(m--)
		{
			int a,b;
			std::cin>>a>>b,deg[a-1]++,deg[b-1]++;
		}
		std::sort(e,e+n,[](int x,int y){return deg[x]>deg[y];});
		int x=0;
		for(;deg[e[x]]>=x;x++);
		int ans[2]{1+std::count_if(e+x,e+n,[=](int y){return deg[y]==x-1;}),std::count_if(e,e+x,[=](int y){return deg[y]==x-1;})};
		if(!ans[1])
			ans[1]=1+std::count_if(e,e+x,[=](int y){return deg[y]==x;});
		std::cout<<ans[0]<<' '<<ans[1]<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

2 1
1 4
1 2

result:

ok 3 lines

Test #2:

score: -100
Runtime Error

input:

2231
1 0
5 7
4 1
3 4
3 1
3 5
4 2
3 2
4 5
5 4
2 1
2 5
2 4
2 3
5 10
3 2
2 5
1 4
4 2
4 5
1 2
1 3
3 5
3 4
1 5
5 10
1 3
2 4
1 4
5 2
2 3
1 5
5 4
1 2
3 4
5 3
5 9
2 5
3 5
2 3
2 1
4 3
3 1
4 1
4 5
2 4
5 4
4 2
4 1
4 5
4 3
5 9
4 1
4 5
3 4
2 4
2 1
3 1
2 5
3 5
3 2
5 4
2 5
2 3
2 1
2 4
5 9
5 2
1 3
4 3
1 2
5 4
4 2
5...

output:

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

result: