結果
問題 | No.456 Millions of Submits! |
ユーザー |
|
提出日時 | 2016-12-08 13:24:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,007 bytes |
コンパイル時間 | 1,187 ms |
コンパイル使用メモリ | 102,984 KB |
実行使用メモリ | 12,032 KB |
最終ジャッジ日時 | 2024-06-23 10:08:28 |
合計ジャッジ時間 | 9,987 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 TLE * 1 -- * 1 |
ソースコード
#include <cstdio>#include <vector>#include <algorithm>#include <array>#include <set>#include <map>#include <queue>#include <tuple>#include <unordered_set>#include <iostream>#include <unordered_map>#include <functional>#include <cmath>#include <cassert>#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))#define repeat_from_reverse(i,m,n) for (int i = (n)-1; (i) >= int(m); --(i))#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)using namespace std;const double eps = 1e-10;double binsearch(int a, int b, double t, double l, double r) {auto f = [&](double n) {return pow(n, a) * pow(log(n), b);};int iteration = 1000; // max<int>(10, log(r - l) * 10);while (iteration --) {double m = (l + r) / 2;(f(m) < t ? l : r) = m;}return l;}int main() {// inputint m; scanf("%d", &m);vector<int> as(m), bs(m);vector<double> ts(m);repeat (i,m) scanf("%d%d%lf", &as[i], &bs[i], &ts[i]);// solvearray<array<vector<int>, 10+1>, 10+1> xs = {};repeat (i,m) xs[as[i]][bs[i]].push_back(i);vector<double> n(m);repeat (a,10+1) {repeat (b,10+1) {if (b == 0) {for (int x : xs[a][b]) {n[x] = pow(ts[x], 1.0/a);}} else {whole(sort, xs[a][b], [&](int x, int y) {return ts[x] < ts[y];});double r = 22027; // exp(10)repeat_reverse (i, int(xs[a][b].size())) {int x = xs[a][b][i];double t = ts[x];r = n[x] = binsearch(a, b, t, 1, r);}}}}// outputrepeat (i,m) {printf("%.12lf\n", n[i]);}return 0;}