QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#380453#5307. Subgraph Isomorphismkevinyang#WA 39ms3820kbC++17542b2024-04-07 04:12:262024-04-07 04:12:27

Judging History

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

  • [2024-04-07 04:12:27]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:3820kb
  • [2024-04-07 04:12:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int t;
	cin >> t;
	while(t--){
		int n,m;
		cin >> n >> m;
		vector<int>deg(n+1);
		for(int i = 0; i<m; i++){
			int x,y;
			cin >> x >> y;
			deg[x]++;
			deg[y]++;
		}
		if(m==n-1){
			cout << "YES\n";
			continue;
		}
		int mx = 0;
		for(int i = 1; i<=n; i++){
			mx = max(mx,deg[i]);
		}
		if(mx==2 && m==n){
			cout << "YES\n";
			continue;
		}
		cout << "NO\n";
	}
	return 0;
}

详细

Test #1:

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

input:

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

output:

YES
YES
NO
YES

result:

ok 4 token(s): yes count is 3, no count is 1

Test #2:

score: -100
Wrong Answer
time: 39ms
memory: 3556kb

input:

33192
2 1
1 2
3 2
1 3
2 3
3 3
1 2
1 3
2 3
4 3
1 4
2 4
3 4
4 3
1 3
1 4
2 4
4 4
1 3
1 4
2 4
3 4
4 4
1 3
1 4
2 3
2 4
4 5
1 3
1 4
2 3
2 4
3 4
4 6
1 2
1 3
1 4
2 3
2 4
3 4
5 4
1 5
2 5
3 5
4 5
5 4
1 4
1 5
2 5
3 5
5 5
1 4
1 5
2 5
3 5
4 5
5 5
1 4
1 5
2 4
3 5
4 5
5 5
1 4
1 5
2 4
2 5
3 5
5 6
1 4
1 5
2 4
2 5
3 ...

output:

YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
N...

result:

wrong answer expected YES, found NO [39th token]