結果

問題 No.2420 Simple Problem
ユーザー ku_senjanku_senjan
提出日時 2023-08-12 14:44:50
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,336 bytes
コンパイル時間 10,578 ms
コンパイル使用メモリ 436,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-30 07:06:07
合計ジャッジ時間 26,857 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 173 ms
5,248 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 AC 65 ms
5,376 KB
testcase_04 AC 356 ms
5,376 KB
testcase_05 AC 213 ms
5,376 KB
testcase_06 AC 430 ms
5,376 KB
testcase_07 AC 413 ms
5,376 KB
testcase_08 AC 417 ms
5,376 KB
testcase_09 AC 415 ms
5,376 KB
testcase_10 AC 415 ms
5,376 KB
testcase_11 AC 410 ms
5,376 KB
testcase_12 AC 430 ms
5,376 KB
testcase_13 AC 411 ms
5,376 KB
testcase_14 AC 409 ms
5,376 KB
testcase_15 AC 422 ms
5,376 KB
testcase_16 AC 420 ms
5,376 KB
testcase_17 AC 429 ms
5,376 KB
testcase_18 AC 416 ms
5,376 KB
testcase_19 AC 420 ms
5,376 KB
testcase_20 AC 413 ms
5,376 KB
testcase_21 AC 450 ms
5,376 KB
testcase_22 AC 421 ms
5,376 KB
testcase_23 AC 417 ms
5,376 KB
testcase_24 AC 416 ms
5,376 KB
testcase_25 AC 417 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 168 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef SENJAN
#define _GLIBCXX_DEBUG
#else
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using bint = boost::multiprecision::cpp_int;
using graph=vector<vector<int>>;
template<class T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
constexpr int INF32=INT_MAX/2;
constexpr ll INF64=LLONG_MAX/2;
constexpr ld PI=3.14159265358979323846;
constexpr int dx[]={0,0,-1,1,-1,-1,1,1},dy[]={-1,1,0,0,-1,1,-1,1};
template<class T> inline bool chmax(T &a,T b){return a<b?a=b,true:false;}
template<class T> inline bool chmin(T &a,T b){return a>b?a=b,true:false;}
inline void dispYN(bool a){cout<<(a?"YES":"NO")<<endl;}
inline void dispYn(bool a){cout<<(a?"Yes":"No")<<endl;}
inline void dispyn(bool a){cout<<(a?"yes":"no")<<endl;}
void _main();
int main(){cin.tie(0)->sync_with_stdio(0);cout<<fixed<<setprecision(16);_main();}

void _main(){
  int n; cin >> n;
  while(n--){
    ll a, b; cin >> a >> b;
    ll l=0, r=1LL<<31;
    ll x = a+b+(ll)sqrt(4*a*b);
    while(r-l>1){
      ll m=(l+r)/2;
      if(m*m<=x) l=m;
      else r=m;
    }
    cout << r << endl;
  }
}
0