結果
問題 | No.1478 Simple Sugoroku |
ユーザー |
![]() |
提出日時 | 2021-04-16 20:59:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 69,960 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 23:45:45 |
合計ジャッジ時間 | 3,506 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #define rep(i, n) for(i = 0; i < n; i++) #define int long long using namespace std; int n, m; int b[100000]; signed main() { int i, j; cin >> n >> m; rep(i, m) cin >> b[i]; sort(b, b + m); double ans = n - 1; int sumGoal = 0; for (i = m - 1; i >= 1; i--) { sumGoal += n - b[i]; double expGoal = (double)sumGoal / (m - i); double cst = b[0] - 1 + (double)m / (m - i) + expGoal; ans = min(ans, cst); } printf("%.14f\n", ans); return 0; }