Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define cin(vec) for(auto& i : vec) cin >> i
- #define cin_2d(vec, n, m) for(int i = 0; i < n; i++) for(int j = 0; j < m && cin >> vec[i][j]; j++);
- #define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n";
- #define cout_map(mp) for(auto& [f, s] : mp) cout << f << " " << s << "\n";
- #define loop(a, b, c) for(int i = a ; i < (b); i += c)
- #define fixed(n) cout << fixed << setprecision(n);
- #define ceil(n, m) ((n / m) + (n % m ? 1 : 0))
- #define all(vec) vec.begin(),vec.end()
- #define rall(vec) vec.rbegin(),vec.rend()
- #define sz size()
- #define fi first
- #define se second
- #define Pair pair <int,int>
- #define ll long long
- #define ull unsigned long long
- #define Mod 1000'000'007
- #define INF 2000'000'000
- #define PI 3.14159265359
- void Code_Crush(){
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- bool bs(ll l, ll r, ll d, ll n){
- while(r >= l){
- ll m = l + (r - l) / 2;
- if(r + ceil(d, (r + 1)) <= n) return true;
- r = m - 1;
- }
- return false;
- }
- int main(){
- Code_Crush();
- int t; cin >> t;
- while(t--){
- ll n, d; cin >> n >> d;
- if(d <= n) cout << "YES\n";
- else cout << (bs(1, n, d, n) ? "YES" : "NO") << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement