結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 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 1 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 long double eps = 1e-10;

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

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