CSES - Datatähti 2023 loppu - Results
Submission details
Task:Pinta-ala
Sender:stpn129
Submission time:2023-01-21 14:23:06 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails

Code

#include<bits/stdc++.h>
#define int long long


using namespace std;

void init_code(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
}

bool cmp (pair<int, int> a, pair<int, int> b) {
   return a.second < b.second;
}

void solve() {
   double a, b;
   cin >> a >> b;
   
   
   double val1 = b - a - 1;
   double val2 = 2 * sqrt(a); 

   if (val1 >= val2) {
      cout << "YES" << '\n';
   } else {
      cout << "NO" << '\n';
   }
}

signed main() {
   init_code();
   int t = 1; 
   cin >> t;
   while(t--){
      solve();
   }
   return 0;
}

/*
cubbli-guest@dx5-cs-b221-09:~$ cd Code
cubbli-guest@dx5-cs-b221-09:~/Code$ ls
code  code.cpp  input.txt  output.txt
cubbli-guest@dx5-cs-b221-09:~/Code$ g++ code.cpp -o code
cubbli-guest@dx5-cs-b221-09:~/Code$ ./code
Segmentation fault (core dumped)
cubbli-guest@dx5-cs-b221-09:~/Code$ 

double l = 0, r = sqrt(a), m = 0;
   for (int i = 0; i < 120; ++i) {
      m = (r + l) / 2;
      if ((m + 1) * (a / m + 1) < b) {
         r = m;
      } else {
         l = m;
      }
   }

   if ((r + 1) * (a / r + 1) == b) {
      cout << "YES" << '\n';
   } else {
      cout << "NO" << '\n';
   }
*/

Test details

Test 1

Verdict: ACCEPTED

input
1000
578049 731905
262997 434601
559974 650052
458543 101143
...

correct output
YES
YES
YES
NO
NO
...

user output
YES
YES
YES
NO
NO
...
Truncated

Test 2

Verdict: ACCEPTED

input
1000
10000 9500
10000 9501
10000 9502
10000 9503
...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...
Truncated

Test 3

Verdict: ACCEPTED

input
961
1 1
1 2
1 3
1 4
...

correct output
NO
NO
NO
YES
YES
...

user output
NO
NO
NO
YES
YES
...
Truncated