結果

問題 No.472 平均順位
ユーザー syake_tasyake_ta
提出日時 2018-08-25 15:07:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 844 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 68,624 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 10:04:55
合計ジャッジ時間 2,812 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const int INF = (int)1e9 + 1;

int n, p;
int dp[2][20010];
int score[5010][5];

int main(void) {
	cin >> n >> p;
	for (int i = 0; i < n; i++) {
		cin >> score[i][0] >> score[i][1] >> score[i][2];
		score[i][3] = 1;
	}

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 20010; 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 < 3; k++) {
				if (j + k <= p) {
					dp[1][j + k] = min(dp[1][j + k], dp[0][j] + score[i][k]);
				}
			}
		}
		for (int j = 0; j <= p; j++) {
			dp[0][j] = dp[1][j];
			dp[1][j] = INF;
		}
	}

	cout << fixed << setprecision(9) << (double)dp[0][p] / (double)n << endl;
	return 0;
}
0