結果
問題 |
No.472 平均順位
|
ユーザー |
|
提出日時 | 2017-12-30 21:21:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 2,214 ms |
コンパイル使用メモリ | 157,956 KB |
実行使用メモリ | 13,768 KB |
最終ジャッジ日時 | 2024-12-21 13:31:02 |
合計ジャッジ時間 | 32,128 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 TLE * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int N, P; ll v[5010][4]; ll dp[2][15010]; int main() { cin >> N >> P; for (int i = 0; i < N; i++) { for (int j = 0; j < 3; j++) { cin >> v[i][j]; } v[i][3] = 1; } int turn = 0; fill(dp[0], dp[2], 1LL << 60); for (int i = 0; i < 4; i++) { dp[turn][i] = v[0][i]; } for (int i = 1; i < N; i++) { fill(dp[!turn], dp[!turn] + P + 1, 1LL << 60); for (int j = 0; j <= P; j++) { for (int k = 0; j - k >= 0; k++) { dp[!turn][j] = min(dp[!turn][j], dp[turn][j - k] + v[i][k]); } } turn = !turn; } printf("%f\n", (double)dp[turn][P] / N); return 0; }