結果

問題 No.1478 Simple Sugoroku
ユーザー akaneakane
提出日時 2021-04-16 21:28:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 914 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 195,044 KB
最終ジャッジ日時 2025-01-20 19:30:18
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 22
権限があれば一括ダウンロードができます

ソースコード

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);
    int 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;
    for(double b:B){
        if(wpr-b<M){
            cerr << ((wpl-1)+ct+(N-b)) << endl;
            ans += ((wpl-1)+ct+(N-b))/ct;
        }
    }
    cout << ans << endl;

}
0