結果

問題 No.1478 Simple Sugoroku
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-04-16 22:22:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 1,602 ms
コンパイル使用メモリ 166,700 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-09-16 01:13:02
合計ジャッジ時間 6,042 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 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 2 ms
4,376 KB
testcase_13 AC 87 ms
4,380 KB
testcase_14 AC 85 ms
4,464 KB
testcase_15 AC 86 ms
4,472 KB
testcase_16 AC 86 ms
4,376 KB
testcase_17 AC 86 ms
4,380 KB
testcase_18 AC 85 ms
4,376 KB
testcase_19 AC 87 ms
4,384 KB
testcase_20 AC 86 ms
4,376 KB
testcase_21 AC 86 ms
4,400 KB
testcase_22 AC 87 ms
4,456 KB
testcase_23 AC 86 ms
4,376 KB
testcase_24 AC 87 ms
4,380 KB
testcase_25 AC 88 ms
4,376 KB
testcase_26 AC 87 ms
4,400 KB
testcase_27 AC 87 ms
4,420 KB
testcase_28 AC 77 ms
4,472 KB
testcase_29 AC 79 ms
4,380 KB
testcase_30 AC 79 ms
4,472 KB
testcase_31 AC 78 ms
4,420 KB
testcase_32 AC 78 ms
4,380 KB
testcase_33 AC 84 ms
4,380 KB
testcase_34 AC 82 ms
4,380 KB
testcase_35 AC 82 ms
4,420 KB
testcase_36 AC 82 ms
4,480 KB
testcase_37 AC 85 ms
4,384 KB
testcase_38 AC 86 ms
4,380 KB
testcase_39 AC 84 ms
4,380 KB
testcase_40 AC 84 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#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;
    for (int t = 0; t < 100; 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 == 99) ans = dp[0];
    }
    printf("%.10f\n",ans+plus);
    return 0;
}
0