結果

問題 No.1064 ∪∩∩ / Cup Cap Cap
ユーザー flamestormflamestorm
提出日時 2020-06-24 10:09:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,663 bytes
コンパイル時間 798 ms
コンパイル使用メモリ 100,640 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 20:56:03
合計ジャッジ時間 2,674 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

const int MAX = 200007;
const int MOD = 1000000007;

int discriminant(long double a, long double b, long double c) {
    if (b*b > 4*a*c) {return 2;}
    else if (b*b == 4*a*c) {return 1;}
    else {return 0;}
}

long double quadratic1(long double a, long double b, long double c) {
    return (((-b) - sqrt(b*b - 4*a*c))/(2 * a));
}

long double quadratic2(long double a, long double b, long double c) {
    return (((-b) + sqrt(b*b - 4*a*c))/(2 * a));
}

void solve() {
    long double a, b, c, d;
    cin >> a >> b >> c >> d;
    if (discriminant(2, a-c, b-d) == 0) {cout << "No"; return;}
    if (discriminant(2, a-c, b-d) == 1) {cout << "Yes"; return;}
    long double res1 = quadratic1(2, a-c, b-d), res2 = quadratic2(2, a-c, b-d);
    pair<long double, long double> point1 = make_pair(res1, res1 * res1 + a * res1 + b);
    pair<long double, long double> point2 = make_pair(res2, res2 * res2 + a * res2 + b);
    long double slope = (point2.second - point1.second) / (point2.first - point1.first);
    long double yInter = point1.second - slope * point1.first;
    cout << fixed << setprecision(17) << slope << " " << yInter;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //int tt; cin >> tt; for (int i = 1; i <= tt; i++) {solve(); cout << endl;}
    solve();
}
0