結果

問題 No.2352 Sharpened Knife in Fall
ユーザー coindarwcoindarw
提出日時 2023-06-16 21:44:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 286 ms / 3,000 ms
コード長 2,882 bytes
コンパイル時間 5,128 ms
コンパイル使用メモリ 263,840 KB
実行使用メモリ 4,572 KB
最終ジャッジ日時 2023-09-06 19:10:47
合計ジャッジ時間 14,863 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 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 218 ms
4,488 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 286 ms
4,412 KB
testcase_07 AC 144 ms
4,380 KB
testcase_08 AC 283 ms
4,568 KB
testcase_09 AC 285 ms
4,400 KB
testcase_10 AC 285 ms
4,500 KB
testcase_11 AC 280 ms
4,496 KB
testcase_12 AC 281 ms
4,572 KB
testcase_13 AC 279 ms
4,416 KB
testcase_14 AC 132 ms
4,380 KB
testcase_15 AC 265 ms
4,508 KB
testcase_16 AC 15 ms
4,384 KB
testcase_17 AC 8 ms
4,384 KB
testcase_18 AC 102 ms
4,384 KB
testcase_19 AC 222 ms
4,400 KB
testcase_20 AC 88 ms
4,380 KB
testcase_21 AC 85 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); ++i)
constexpr int inf = 2000'000'000;
constexpr ll linf = 4000000000000000000ll;
constexpr ll M7 = 1000000007ll;
constexpr ll M09 = 1000000009ll;
constexpr ll M9 = 998244353ll;
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using namespace atcoder;
template <typename T>
inline ostream& operator<<(ostream& os, vector<T>& v) {
    for (auto& e : v) os << e << " ";
    return os;
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) noexcept {
    return os << "(" << p.first << ", " << p.second << ")";
}
#ifdef ONLINE_JUDGE
#define debug(...)
#else
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">: ", debug_out(__VA_ARGS__)
template <typename T>
void debug_out(T t) {
    cerr << t << endl;
}
template <typename T, typename... Args>
void debug_out(T t, Args... args) {
    cerr << t << ", ";
    debug_out(args...);
}
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r, k;
    cin >> r >> k;
    auto f = [&](double t) { return (t - sin(t)) / 2; };
    vector<double> v;
    if (k % 2 == 0) {
        reps(i, k / 2) {
            auto cmp = [&](double t) { return f(t) < i * M_PI / (k + 1); };
            auto bsearch = [&]() {
                double ok = 0, ng = M_PI;
                rep(_, 100) {
                    double mid = (ng + ok) / 2;
                    if (cmp(mid))
                        ok = mid;
                    else
                        ng = mid;
                }
                return ok;
            };
            double t = bsearch();
            v.push_back(cos(t / 2) * r);
            v.push_back(-cos(t / 2) * r);
        }
    } else {
        v.push_back(0);
        reps(i, k / 2) {
            auto cmp = [&](double t) { return f(t) < i * M_PI / (k + 1); };
            auto bsearch = [&]() {
                double ok = 0, ng = M_PI;
                rep(_, 100) {
                    double mid = (ng + ok) / 2;
                    if (cmp(mid))
                        ok = mid;
                    else
                        ng = mid;
                }
                return ok;
            };
            double t = bsearch();
            v.push_back(cos(t / 2) * r);
            v.push_back(-cos(t / 2) * r);
        }
    }
    sort(all(v));
    cout << fixed << setprecision(10);
    for (double x : v) {
        cout << x << "\n";
    }
    return 0;
}
0