結果
| 問題 |
No.1064 ∪∩∩ / Cup Cap Cap
|
| コンテスト | |
| ユーザー |
sashiming
|
| 提出日時 | 2020-05-29 22:15:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 1,909 bytes |
| コンパイル時間 | 1,851 ms |
| コンパイル使用メモリ | 194,552 KB |
| 最終ジャッジ日時 | 2025-01-10 17:38:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 36 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using lnt = long long;
using Real = long double;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)
#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)
constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;
int main(){
summon_tourist;
Real a, b, c, d; cin >> a >> b >> c >> d;
Real e = a-c, f = b-d; // y = 2x^2 + ex + f
if(abs(e*e - 4*2*f) < eps) cout << "Yes" << ln;
else if(e*e - 4*2*f < 0.0) cout << "No" << ln;
else {
// cerr << e << ' ' << f << ln;
Real x1 = (-e-sqrtl(e*e - 4*2*f)) / 4.0;
Real x2 = (-e+sqrtl(e*e - 4*2*f)) / 4.0;
Real y1 = x1*x1 + a*x1 + b;
Real y2 = x2*x2 + a*x2 + b;
// cerr << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << ln;
Real p = (y1-y2) / (x1-x2);
Real q = y1 - p*x1;
dcout << p << ' ' << q << ln;
}
}
sashiming