結果

問題 No.172 UFOを捕まえろ
ユーザー umezoumezo
提出日時 2022-07-22 07:42:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 2,099 ms
コンパイル使用メモリ 198,040 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-09-16 13:38:06
合計ジャッジ時間 3,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,384 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,376 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int x,y,r;
  cin>>x>>y>>r;
  x=abs(x),y=abs(y);
  
  int b=1;
  if(x*x+y*y==0) b=0;
  auto f=[&](int n){
    if(b==0){
      if(2*r*r<n*n) return true;
      return false;
    }
    else{
      if(n<=x+y) return false;
      if(r*r*(x+y)*(x+y)<(n-x-y)*(n-x-y)*(x*x+y*y)) return true;
      return false;
    }
  };
  
  int ok=500,ng=0;
  while(ok-ng>1){
    int mid=(ok+ng)/2;
    if(f(mid)) ok=mid;
    else ng=mid;
  }
  cout<<ok<<endl;
  
  return 0;
}
0