Advertisement
7oSkaaa

Deadline

Aug 10th, 2021
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1.   #include <bits/stdc++.h>
  2.   using namespace std;
  3.  
  4.   #define cin(vec) for(auto& i : vec) cin >> i
  5.   #define cin_2d(vec, n, m) for(int i = 0; i < n; i++) for(int j = 0; j < m && cin >> vec[i][j]; j++);
  6.   #define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n";
  7.   #define cout_map(mp) for(auto& [f, s] : mp) cout << f << "  " << s << "\n";
  8.   #define loop(a, b, c) for(int i = a ; i < (b); i += c)
  9.   #define fixed(n) cout << fixed << setprecision(n);
  10.   #define ceil(n, m) ((n / m) + (n % m ? 1 : 0))
  11.   #define all(vec) vec.begin(),vec.end()
  12.   #define rall(vec) vec.rbegin(),vec.rend()
  13.   #define sz size()
  14.   #define fi first
  15.   #define se second
  16.   #define Pair pair <int,int>
  17.   #define ll long long
  18.   #define ull unsigned long long
  19.   #define Mod  1000'000'007
  20.   #define INF 2000'000'000
  21.   #define PI 3.14159265359
  22.  
  23.   void Code_Crush(){
  24.     ios_base::sync_with_stdio(false);   cin.tie(nullptr);   cout.tie(nullptr);
  25.     #ifndef ONLINE_JUDGE
  26.       freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  27.     #endif
  28.   }
  29.   bool bs(ll l, ll r, ll d, ll n){
  30.     while(r >= l){
  31.       ll m = l + (r - l) / 2;
  32.       if(r + ceil(d, (r + 1)) <= n) return true;
  33.       r = m - 1;
  34.     }
  35.     return false;
  36.   }  
  37.   int main(){
  38.     Code_Crush();
  39.     int t;                cin >> t;
  40.     while(t--){
  41.       ll n, d;            cin >> n >> d;
  42.       if(d <= n) cout << "YES\n";
  43.       else cout << (bs(1, n, d, n) ? "YES" : "NO") << "\n";
  44.     }
  45.     return 0;
  46.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement