QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#262807 | #5745. Graph Isomorphism | w4p3r# | WA | 8ms | 3812kb | C++20 | 1.3kb | 2023-11-24 04:12:02 | 2023-11-24 04:12:03 |
Judging History
answer
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define db double
#define ve vector<int>
#define pa pair<int,int>
#define fr first
#define sd second
#define pb push_back
#define mp make_pair
#define MEM(a) memset(a,0,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
inline ll read()
{
char ch = getchar();
ll s = 0, w = 1;
while (ch < '0' || ch > '9') {if (ch == '-')w = -1; ch = getchar();}
while (ch >= '0' && ch <= '9') {s = s * 10 + ch - '0'; ch = getchar();}
return s * w;
}
void sol()
{
int n, m;
cin >> n >> m;
vector<int>deg(n + 1);
for (int i = 1; i <= m; i ++)
{
int x, y;
cin >> x >> y;
deg[x] ++, deg[y] ++;
}
int mx = 0, mn = inf;
for (int i = 1; i <= n; i ++)mx = max(mx, deg[i]), mn = min(mn, deg[i]);
if (n <= 3) {cout << "YES\n"; return ;}
if (m == 0 || m == 1LL * n * (n - 1) / 2 || (m == n - 1 && mx == n - 1) || (m == 1LL * (n - 1) * (n - 2) / 2 && mn == 0)) {cout << "YES\n"; return ;}
cout << "NO\n";
}
signed main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T; cin >> T;
while (T --)sol();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
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: 8ms
memory: 3748kb
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: 8ms
memory: 3812kb
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 NO YES NO 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 NO YES NO YES YES YES NO YES YES NO YES NO YES NO YES YES YES YES NO YES YES YES YES YES ...
result:
wrong answer expected YES, found NO [83rd token]