結果

問題 No.1064 ∪∩∩ / Cup Cap Cap
ユーザー chocono2230chocono2230
提出日時 2020-05-29 22:54:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,713 bytes
コンパイル時間 1,607 ms
コンパイル使用メモリ 163,964 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 00:30:59
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2 ms
5,376 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

const double eps = 1e-8;

double fc(double n, double a, double b, double c, double d){
  double ret = -2*n*n + (c - a)*n + (d-b);
  return ret;
}

int main(){
  int ia, ib, ic, id;
  double  a, b, c, d;
  cin >> ia >> ib >> ic >> id;
  if(id - ib < 0){
    cout << "No" << endl;
    return 0;
  }else if(id - ib == 0){
    cout << "Yes" << endl;
    return 0;
  }
  a = ia; b = ib; c = ic; d = id;
  // double r = (c-a) * (c-a) + 8*(d-b);
  // double sq = mysqrtl(r);
  // double xa = ((c - a) + sq)/4;
  // double xb = ((c - a) - sq)/4;
  // double ya = xa*xa + a*xa + b;
  // double yb = xb*xb + a*xb + b;
  // double p = (yb-ya)/(xb-xa);
  // double q = -p * xa + ya;
  double m = (c-a)/4;
  cerr << m << endl;
  double lim = -1e18, l = m;
  while(l-lim > eps){
    double mid = (l+lim)/2;
    double fa = fc(mid, a, b, c, d);
    if(fa < 0) lim = mid;
    else l = mid;
  }
  lim = 1e18;
  double r = m;
  while(lim-r > eps){
    double mid = (r+lim)/2;
    double fa = fc(mid, a, b, c, d);
    if(fa >= 0) r = mid;
    else lim = mid;
  }
  cout << fixed << setprecision(15) << l<< " " << r << endl;
  double ya = l*l + a*l + b;
  double yb = r*r + a*r + b;
  double p = (yb-ya)/(r-l);
  double q = -p * l + ya;
  cout << fixed << setprecision(15) << p << " " << q << endl;
  return 0;
}
0