結果
問題 | No.456 Millions of Submits! |
ユーザー | はむこ |
提出日時 | 2017-05-17 15:46:08 |
言語 | C++11 (gcc 11.4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,158 bytes |
コンパイル時間 | 1,713 ms |
コンパイル使用メモリ | 173,488 KB |
実行使用メモリ | 35,464 KB |
最終ジャッジ日時 | 2024-06-23 18:45:36 |
合計ジャッジ時間 | 7,997 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:61:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 61 | scanf("%lld", &m); | ~~~~~^~~~~~~~~~~~ main.cpp:67:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 67 | scanf("%lld %lld", &av[i], &bv[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:68:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 68 | scanf("%lf", &tv[i]); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) #define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++) #define pb push_back #define all(x) (x).begin(), (x).end() template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if (!v.empty()) { o << '['; copy(v.begin(), v.end(), ostream_iterator<T>(o, ", ")); o << "\b\b]"; } return o; } using ll = long long; using vll = vector<ll>; using vi = vector<int>; typedef pair<ll, ll> P; static const double EPS = 1e-14; static const long long INF = 1e18; #define MAX_N 100005 ll m; vll av, bv; vector<double> tv, ret; void solve(ll i) { int a = av[i], b = bv[i]; double t = tv[i]; if (!a) { ret[i] = exp(pow(t, 1.0 / b)); return; } if (!b) { ret[i] = pow(t, 1.0 / a); return; } double rl = 1e-12; double rr = 11; double prev_m = 100; while (1) { double m = (rl + rr) / 2; if (abs(prev_m - m) < 1e-10) break; (pow(m, a) * pow(log(m), b) - t > 0) ? rr = m : rl = m; prev_m = m; } double n = rl; ret[i] = n; } void parallel_rep(int n, function<void(ll)> f, ll thnum = 50) { vll range(thnum); rep(i, thnum) range[i] = i * m / thnum; range.pb(m); vector<thread> t(thnum); rep(i, thnum) { t[i] = thread([&](ll l, ll r){ repi(j, l, r) solve(j); }, range[i], range[i+1]); } rep(i, thnum) { t[i].join(); } } int main(void) { scanf("%lld", &m); av.resize(m); bv.resize(m); tv.resize(m); ret.resize(m); rep(i, m) { scanf("%lld %lld", &av[i], &bv[i]); scanf("%lf", &tv[i]); } parallel_rep(m, solve, 100); rep(i, m) { printf("%.10f\n", ret[i]); } return 0; }