結果
問題 | No.2352 Sharpened Knife in Fall |
ユーザー | nu50218 |
提出日時 | 2023-06-16 21:48:52 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 556 ms / 3,000 ms |
コード長 | 1,362 bytes |
コンパイル時間 | 3,705 ms |
コンパイル使用メモリ | 222,824 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-24 13:44:56 |
合計ジャッジ時間 | 17,194 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#ifdef LOCAL #include <local.hpp> #else #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2") #include <bits/stdc++.h> #define debug(...) ((void)0) #define postprocess(...) ((void)0) #endif using namespace std; using ll = long long; using ld = long double; const ld pi = acosl(-1.0l); inline ld eval(const ld R, const ld theta) { return R * R * (pi * (pi - 2.0l * theta) / (2.0l * pi) - cosl(theta) * sinl(theta)); } inline ld search(const ld R, const ld S) { ld imin = 0.0l; ld imax = pi / 2.0l; for (int _ = 0; _ < 60; _++) { ld imid = (imin + imax) / 2.0l; (S <= eval(R, imid) ? imin : imax) = imid; } return (imin + imax) / 2.0l; } void solve([[maybe_unused]] int test) { ld R; int K; cin >> R >> K; vector<ld> ans; for (int i = 0; i < K / 2; i++) { ld S = pi * R * R * (ld)(i + 1) / (ld)(K + 1); ld theta = search(R, S); ans.push_back(R * sinl(theta)); ans.push_back(-R * sinl(theta)); } if (K % 2) ans.push_back(0); sort(ans.begin(), ans.end()); for (int i = 0; i < K; i++) { cout << ans[i] << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(i); } postprocess(); }