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_2d(vec, n, m) for(int i = 0; i < n; i++, cout << "\n") for(int j = 0; j < m && cout << vec[i][j] << " "; j++);
- #define cout_map(mp) for(auto& [f, s] : mp) cout << f << " " << s << "\n";
- #define Time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << "\n";
- #define fixed(n) fixed << setprecision(n)
- //#define ceil(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
- #define fill(vec, value) memset(vec, value, sizeof(vec));
- #define Num_of_Digits(n) ((int)log10(n)+1)
- #define all(vec) vec.begin(),vec.end()
- #define rall(vec) vec.rbegin(),vec.rend()
- #define sz(x) int(x.size())
- #define TC int t; cin >> t; while(t--)
- #define fi first
- #define se second
- #define Pair pair < int, int >
- #define ll long long
- #define ull unsigned long long
- #define Mod 1'000'000'007
- #define OO 2'000'000'000
- #define EPS 1e-9f
- #define PI acos(-1)
- #define imin INT_MIN
- #define imax INT_MAX
- #define getline(s) getline(cin >> ws , s)
- #define pb(x) push_back(x)
- #define to_decimal(bin) stoi(bin, nullptr, 2)
- #define mod_combine(a, b, m) (((a % m) * (b % m)) % m)
- #define debug(x) cout << #x << ": " << (x) << "\n";
- 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
- Time
- }
- /*
- Notes
- Lower bound -> smallest number greater than or (equal) tagret
- Upper bound -> smallest number greater than target
- n % a = (n + x * a) % a
- */
- int Binary_Search(double n, double d){
- int l = 1, r = n, best = 0;
- //while(r < n) r *= 2;
- while(l <= r){
- int m = l + (r - l) / 2;
- (m + ceil(d / double(m + 1)) <= n ? l = m + 1, best = m : r = m - 1);
- }
- return best;
- }
- void Solve(){
- double n, d;
- cin >> n >> d;
- if(d <= n) return void(cout << "YES" << '\n');
- cout << (Binary_Search(n, d) <= n && Binary_Search(n, d) != 0 ? "YES" : "NO") << '\n';
- }
- int main (){
- Code_Crush();
- int t = 1;
- cin >> t;
- while(t--){
- Solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement