0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-28 12:11:58 +00:00

B - Diameter of Graph

https://codeforces.com/contest/1581/submission/130353768
This commit is contained in:
Baoshuo Ren 2021-09-30 20:34:51 +08:00 committed by Baoshuo Ren
parent d1e3ca9f09
commit 810d9e19a3
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

19
CodeForces/1581/B/B.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <bits/stdc++.h>
using namespace std;
long long t, n, m, k;
int main() {
cin >> t;
while (t--) {
cin >> n >> m >> k;
k -= 2;
if (n == 1) {
cout << (m == 0 && k >= 0 ? "YES" : "NO") << endl;
} else {
cout << ((m < n - 1 || n * (n - 1) < m * 2 || (n * (n - 1) == m * 2 && k < 1) || (n * (n - 1) > m * 2 && k < 2)) ? "NO" : "YES") << endl;
}
}
return 0;
}