結果
問題 | No.1478 Simple Sugoroku |
ユーザー |
![]() |
提出日時 | 2021-04-16 21:52:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,010 bytes |
コンパイル時間 | 2,017 ms |
コンパイル使用メモリ | 196,484 KB |
最終ジャッジ日時 | 2025-01-20 19:49:08 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 21 |
ソースコード
#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; } }