QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#120332 | #5745. Graph Isomorphism | UrgantTeam# | WA | 10ms | 3504kb | C++23 | 1.1kb | 2023-07-06 16:48:38 | 2023-07-06 16:48:39 |
Judging History
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) return true;
if (m0 + k1 >= n) 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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3500kb
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: 10ms
memory: 3356kb
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: 3504kb
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]