結果

問題 No.2420 Simple Problem
ユーザー umezoumezo
提出日時 2023-08-12 14:13:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,143 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 7,190 ms
コンパイル使用メモリ 455,656 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 05:25:51
合計ジャッジ時間 40,566 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 461 ms
6,940 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 AC 170 ms
6,940 KB
testcase_04 AC 900 ms
6,940 KB
testcase_05 AC 569 ms
6,944 KB
testcase_06 AC 1,127 ms
6,944 KB
testcase_07 AC 1,135 ms
6,940 KB
testcase_08 AC 1,129 ms
6,944 KB
testcase_09 AC 1,123 ms
6,940 KB
testcase_10 AC 1,123 ms
6,940 KB
testcase_11 AC 1,127 ms
6,940 KB
testcase_12 AC 1,139 ms
6,944 KB
testcase_13 AC 1,131 ms
6,940 KB
testcase_14 AC 1,123 ms
6,940 KB
testcase_15 AC 1,128 ms
6,940 KB
testcase_16 AC 1,121 ms
6,940 KB
testcase_17 AC 1,123 ms
6,940 KB
testcase_18 AC 1,122 ms
6,944 KB
testcase_19 AC 1,131 ms
6,940 KB
testcase_20 AC 1,123 ms
6,940 KB
testcase_21 AC 1,121 ms
6,944 KB
testcase_22 AC 1,130 ms
6,940 KB
testcase_23 AC 1,123 ms
6,944 KB
testcase_24 AC 1,143 ms
6,944 KB
testcase_25 AC 1,120 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 896 ms
6,940 KB
testcase_28 AC 898 ms
6,940 KB
testcase_29 AC 901 ms
6,944 KB
testcase_30 AC 899 ms
6,944 KB
testcase_31 AC 895 ms
6,944 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 450 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef unsigned long long ll;
 
#include<bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

Bint f(Bint a,Bint b){
  Bint ok=70000,ng=0;
  while(ok-ng>1){
    Bint m=(ok+ng)/2;
    if(m*m-a-b<0) ng=m;
    else if(m*m*m*m+a*a+b*b>2*(a*m*m+b*m*m+a*b)) ok=m;
    else ng=m;
  }
  return ok;
}
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  rep(i,n){
    Bint a,b;
    cin>>a>>b;
    cout<<f(a,b)<<'\n';
  }
    
  return 0;
}
0