結果

問題 No.2352 Sharpened Knife in Fall
ユーザー 👑 nu50218nu50218
提出日時 2023-06-16 21:46:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,358 bytes
コンパイル時間 3,140 ms
コンパイル使用メモリ 219,244 KB
実行使用メモリ 5,804 KB
最終ジャッジ日時 2023-09-06 19:14:50
合計ジャッジ時間 12,219 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 303 ms
5,620 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    ld imax = pi / 2.0l;

    while (imax - imin > 1e-7) {
        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();
}
0