結果

問題 No.472 平均順位
ユーザー suika_psuika_p
提出日時 2019-09-19 17:06:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,533 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 167,428 KB
実行使用メモリ 589,856 KB
最終ジャッジ日時 2023-09-26 14:20:50
合計ジャッジ時間 9,761 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

double dp[5001][15001];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, P; cin >> N >> P;
    vector<int> a(N), b(N), c(N);
    rep(i, N) cin >> a[i] >> b[i] >> c[i];
    Fill(dp, 100000.0);
    rep(i, 4) dp[0][i] = 0;
    rep(i, N) reps(j, P) {
        if (abs(dp[i][j] - 100000) <= 0.01) continue;
        chmin(dp[i+1][j], ((dp[i][j] * i) + a[i]) / (i + 1));
        chmin(dp[i+1][j+1], ((dp[i][j] * i) + b[i]) / (i + 1));
        chmin(dp[i+1][j+2], ((dp[i][j] * i) + c[i]) / (i + 1));
        chmin(dp[i+1][j+3], ((dp[i][j] * i) + 1) / (i + 1));
    }
    printf("%.12lf\n", dp[N][P]);
    return 0;
}
0