結果

問題 No.456 Millions of Submits!
ユーザー pekempeypekempey
提出日時 2016-12-07 22:32:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,589 bytes
コンパイル時間 2,560 ms
コンパイル使用メモリ 180,336 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2023-09-05 06:26:05
合計ジャッジ時間 10,818 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize ("fast-math")
#include <bits/stdc++.h>
using namespace std;

double power(double a, int b) {
    double res = 1;
    while (b > 0) {
        if (b & 1) {
            res *= a;
        }
        a *= a;
        b /= 2;
    }
    return res;
}

int main() {
    int m;
    cin >> m;
    double maxi = exp(10);
    while (m--) {
        int a, b;
        double t;
        scanf("%d %d %lf", &a, &b, &t);
        double ans = 0;
        {
            double ok = 1.1;
            double ng = 0;
            for (int ii = 0; ii < 38; ii++) {
                double mid = (ok + ng) / 2;
                if (power(mid, a) * power(log(mid), b) >= t) {
                    ok = mid;
                } else {
                    ng = mid;
                }
            }
            if (ok < 1 + 1e-6) {
                ans = ok;
                printf("%.15f\n", ans);
                continue;
            }
        }
        {
            double ok = maxi;
            double ng = 1;
            double logT = log(t);
            for (int ii = 0; ii < 48; ii++) {
                double mid = (ok + ng) / 2;
                double logN = log(mid);
                double loglogN = log(logN);
                if (a * logN + b * loglogN >= logT) {
                    ok = mid;
                } else {
                    ng = mid;
                }
            }
            if (ok > 1 + 1e-9) {
                ans = ok;
                printf("%.15f\n", ans);
                continue;
            }
        }
    }
}
0