QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#120339#5745. Graph IsomorphismUrgantTeam#WA 10ms3444kbC++231.1kb2023-07-06 16:51:432023-07-06 16:51:44

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-06 16:51:44]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3444kb
  • [2023-07-06 16:51:43]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using vi = vector<int>;
using ll = int64_t;
using pii = pair<int, int>;
using vpii = vector<pii>;

int find_ans(const int n, const vpii& e) {
	vi d(n);
	for (pii f : e) {
		++d[f.first];
		++d[f.second];
	}
	int k0 = 0, k1 = 0, m0 = 0, m1 = 0;
	for (int i : d) {
		if (i == 0) ++k0;
		if (i == 1) ++k1;
		if (i == n - 1) ++m0;
		if (i == n - 2) ++m1;
	}
	if (k0 + m1 >= n && k0 >= 1) return true;
	if (m0 + k1 >= n && m0 >= 1) return true;
	if (k0 || m0) return false;
	return n == 4;
}
void solve_test() {
	int n, m;
	cin >> n >> m;
	vpii e(m);
	for (int i = 0; i < m; ++i) {
		cin >> e[i].first >> e[i].second;
		--e[i].first; --e[i].second;
	}
	cout << (find_ans(n, e) ? "YES\n" : "NO\n");
}
void solve_tests() {
	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		solve_test();
	}
}
int main() {
#ifdef ONPC
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve_tests();
}

详细

Test #1:

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

input:

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

output:

YES
YES
NO

result:

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

Test #2:

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

input:

39982
3 2
2 1
3 2
2 1
1 2
2 1
2 1
3 3
3 1
2 3
1 2
2 1
1 2
3 3
3 1
3 2
2 1
2 1
1 2
3 2
1 2
3 1
3 3
2 1
3 1
2 3
2 1
1 2
3 2
2 1
3 2
3 3
2 3
3 1
2 1
3 3
2 1
1 3
2 3
3 3
3 1
3 2
1 2
2 1
2 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
1 2
3 2
1 3
3 2
3 2
1 2
1 3
3 2
3 2
1 3
2 1
1 2
3 2
3 2
3 1
3 3
2 3
3 1
1 2
2 1
1 2
3 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 39982 token(s): yes count is 39982, no count is 0

Test #3:

score: -100
Wrong Answer
time: 10ms
memory: 3396kb

input:

33365
3 3
3 1
2 3
2 1
2 1
2 1
4 6
1 2
3 4
4 2
2 3
3 1
4 1
2 1
1 2
2 1
1 2
4 5
1 4
1 2
4 2
3 4
1 3
4 3
4 2
2 1
1 3
3 1
3 2
4 3
1 3
1 2
3 4
3 3
3 2
3 1
2 1
3 1
2 3
3 1
1 3
3 1
2 1
3 2
1 3
3 2
4 5
3 1
4 2
3 4
2 3
2 1
4 2
1 2
3 2
2 1
2 1
3 2
1 2
2 3
3 1
3 2
4 1
3 4
3 1
2 1
4 3
1 2
4 2
3 2
2 1
2 1
4 5
3 ...

output:

YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
...

result:

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