結果

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

テストケース

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

ソースコード

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((n+x-y)*(n+x-y)<2*(x*x+(n-y)*(n-y)-r*r)) 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