結果

問題 No.472 平均順位
ユーザー mogurockermogurocker
提出日時 2017-10-14 18:18:26
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 730 bytes
コンパイル時間 1,311 ms
コンパイル使用メモリ 158,328 KB
実行使用メモリ 296,960 KB
最終ジャッジ日時 2024-04-28 19:38:38
合計ジャッジ時間 5,102 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 7 ms
7,680 KB
testcase_09 AC 23 ms
19,584 KB
testcase_10 AC 25 ms
26,368 KB
testcase_11 AC 63 ms
53,760 KB
testcase_12 AC 50 ms
47,616 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 40 ms
25,728 KB
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, p, dp[5005][15005];
const int INF = 1000000007;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> p;
	FOR(i, n+1) FOR(j, 3*n+1) dp[i][j] = INF;
	FOR(i, n) {
		int v[4];
		FOR(k, 3) cin >> v[k];
		v[3] = 1;
		if (i == 0) {
			FOR(k, 4) dp[i+1][k] = v[k];
		}
		else {
			FOR(j, p+1) {
				FOR(k, 4) {
					if (j+k <= p) dp[i+1][j+k] = min(dp[i+1][j+k], dp[i][j]+v[k]);
				}
			}
		}

	}
	printf("%.10lf\n", dp[n][p]/(double)n);
	return 0;
}
0