QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244578 | #5747. Persian Casino | ucup-team870# | WA | 1ms | 3544kb | C++14 | 1.3kb | 2023-11-09 12:19:07 | 2023-11-09 12:19:08 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=l; i<=r; i++)
#define per(i,r,l) for(int i=r; i>=l; i--)
#define IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int du[100010];
int main() {
int T; scanf("%d", &T);
while (T--) {
int n, m; scanf("%d%d", &n, &m);
rep (i, 1, m) {
int u, v;
scanf("%d%d", &u, &v);
du[u]++, du[v]++;
}
if (m == 1ll * n * (n-1)/2) {
puts("YES");
} else if (n <= 3) {
puts("YES");
} else {
int mn = 1e9, mx = 0;
rep (i, 1, n) mn = min(mn, du[i]), mx = max(mx, du[i]);
if (mn == 0 && m == 1ll * (n-1) * (n-2)/2) {
puts("YES");
} else if (n == 4 && du[1] == 1 && du[2] == 1 && du[3] == 1 && du[4] == 1){
puts("YES");
} else if (n == 4 && du[1] == 2 && du[2] == 2 && du[3] == 2 && du[4] == 2 && m == 4){
puts("YES");
} else if (mx == n-1 && m == n-1) {
puts("YES");
} else {
puts("NO");
}
}
rep (i, 1, n) du[i] = 0;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3544kb
input:
4 2 1 4 1 3 2 57639 34614
output:
YES YES YES YES
result:
wrong answer 1st lines differ - expected: '3', found: 'YES'