結果
問題 | No.472 平均順位 |
ユーザー | pin |
提出日時 | 2017-11-16 19:50:15 |
言語 | C++11 (gcc 11.4.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 857 bytes |
コンパイル時間 | 818 ms |
コンパイル使用メモリ | 73,100 KB |
実行使用メモリ | 589,948 KB |
最終ジャッジ日時 | 2024-05-04 00:53:07 |
合計ジャッジ時間 | 4,852 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 4 ms
17,880 KB |
testcase_05 | AC | 3 ms
6,940 KB |
testcase_06 | AC | 3 ms
9,692 KB |
testcase_07 | AC | 5 ms
18,160 KB |
testcase_08 | AC | 11 ms
25,096 KB |
testcase_09 | AC | 27 ms
23,296 KB |
testcase_10 | AC | 20 ms
18,176 KB |
testcase_11 | AC | 78 ms
60,672 KB |
testcase_12 | AC | 57 ms
61,816 KB |
testcase_13 | AC | 198 ms
154,240 KB |
testcase_14 | MLE | - |
testcase_15 | AC | 255 ms
169,256 KB |
testcase_16 | MLE | - |
testcase_17 | MLE | - |
testcase_18 | AC | 55 ms
87,276 KB |
testcase_19 | AC | 114 ms
136,916 KB |
ソースコード
#include <iostream> #include <iomanip> #include <cstring> #include <algorithm> #include <queue> #include <functional> #include <map> #include <vector> #include <string> using namespace std; typedef long long ll; const ll INF = 10000000000000; ll dp[5005][15005]; ll n, p, a[5005][4]; int main(void){ cin >> n >> p; for (int i = 0; i < n; i++){ cin >> a[i][0] >> a[i][1] >> a[i][2]; a[i][3] = 1; } for (int i = 0; i <= n; i++){ for (int j = 0; j <= p; j++){ dp[i][j] = INF; } } dp[0][0] = 0; for (int i = 0; i < n; i++){ for (int j = 0; j <= p; j++){ for (int k = 0; k < 4; k++){ if (k <= j) dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - k]+a[i][k]); } } } double ans = (double)dp[n][p] / n; cout << ans << endl; }