結果

問題 No.1478 Simple Sugoroku
ユーザー akaneakane
提出日時 2021-04-16 21:52:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,010 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 201,660 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-16 00:23:18
合計ジャッジ時間 5,157 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
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 -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 70 ms
4,408 KB
testcase_30 AC 69 ms
4,376 KB
testcase_31 AC 70 ms
4,376 KB
testcase_32 AC 69 ms
4,376 KB
testcase_33 AC 20 ms
4,408 KB
testcase_34 AC 20 ms
4,376 KB
testcase_35 AC 20 ms
4,380 KB
testcase_36 AC 19 ms
4,376 KB
testcase_37 AC 14 ms
4,380 KB
testcase_38 AC 15 ms
4,376 KB
testcase_39 AC 15 ms
4,376 KB
testcase_40 AC 15 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); i++)
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    double N,M; cin>>N>>M;
    vector<double> B;
    rep(i,M){
        int x; cin>>x;
        B.push_back(x);
    }

    if(M==1){
        cout << (double)N-1 << endl; return 0;
    }
    double wpl=B[0], wpr=B[B.size()-1];

    double ans=0;
    double ct=0;
    for(double b:B){
        if(wpr-b<=M){
            ct++;
        }
    }
    if(M==2){
        if(wpr-wpl==1){
            cout << N-1 << endl; return 0;
        }
        ans += ((wpl-1)+2+(N-wpr))/1;
        cout << ans << endl; return 0;
    }
    cerr << ct <<endl;
    double mm = M;
    for(double b:B){
        if(wpr-b<=M){
            cerr << ((wpl-1)+1/mm*(N-b)) << endl;
            ans += ((wpl-1)+ ct + (N-b))/ct;
        }
    }
    if(N-1<ans){
        cout << N-1 << endl;
    }else{
        cout << ans << endl;
    }

}
0