結果

問題 No.1478 Simple Sugoroku
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-04-16 22:29:53
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 930 bytes
コンパイル時間 1,575 ms
コンパイル使用メモリ 166,812 KB
実行使用メモリ 4,528 KB
最終ジャッジ日時 2023-09-16 01:25:46
合計ジャッジ時間 4,695 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 63 ms
4,524 KB
testcase_14 AC 61 ms
4,520 KB
testcase_15 AC 63 ms
4,512 KB
testcase_16 AC 63 ms
4,492 KB
testcase_17 AC 62 ms
4,392 KB
testcase_18 AC 62 ms
4,432 KB
testcase_19 AC 63 ms
4,376 KB
testcase_20 AC 62 ms
4,528 KB
testcase_21 AC 62 ms
4,504 KB
testcase_22 AC 63 ms
4,472 KB
testcase_23 AC 63 ms
4,472 KB
testcase_24 AC 63 ms
4,376 KB
testcase_25 AC 63 ms
4,376 KB
testcase_26 AC 63 ms
4,520 KB
testcase_27 AC 63 ms
4,496 KB
testcase_28 AC 52 ms
4,468 KB
testcase_29 AC 54 ms
4,380 KB
testcase_30 AC 54 ms
4,524 KB
testcase_31 AC 55 ms
4,392 KB
testcase_32 AC 54 ms
4,452 KB
testcase_33 AC 57 ms
4,516 KB
testcase_34 AC 57 ms
4,492 KB
testcase_35 AC 57 ms
4,464 KB
testcase_36 AC 57 ms
4,392 KB
testcase_37 AC 61 ms
4,428 KB
testcase_38 AC 59 ms
4,380 KB
testcase_39 AC 59 ms
4,404 KB
testcase_40 AC 60 ms
4,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.04.16 22:27:32
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n,m;cin >> n >> m;
    vector<int> a(m);
    double plus = 0;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        if (i == 0) plus += a[i]-1;
        else if (i == m-1) plus += n-a[i];
    }
    double left = 0, right = 1000000000;
    double ans;
    int loop_cnt = 50;
    for (int t = 0; t < loop_cnt; t++) {
        double mid = (left+right)/2;
        vector<double> dp(m,0);
        double sum = 0;
        for (int i = m-2; i >= 0; i--) {
            dp[i] = min(dp[i+1]+a[i+1]-a[i],mid+1);
            sum += dp[i];
        }
        if (sum/m >= mid) {
            left = mid;
        }
        else {
            right = mid;
        }
        if (t == loop_cnt-1) ans = dp[0];
    }
    printf("%.10f\n",ans+plus);
    return 0;
}
0