0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 01:46:27 +00:00
OI-codes/Codeforces/1581/B/B.cpp
2022-04-01 18:33:24 +08:00

20 lines
444 B
C++

#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;
}