結果

問題 No.472 平均順位
コンテスト
ユーザー ssssskkkkk
提出日時 2017-11-27 15:28:29
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 687 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 638 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-21 17:12:25
合計ジャッジ時間 3,866 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;
typedef long double ld;
const int INF = 1 << 29;
int N, P;
int dp1[15500],  dp2[15500];
int main(void) {
	cin >> N >> P;
	for (int p = 0; p <= P; ++p) dp1[p] = dp2[p] = INF;
	dp1[0] = 0;
	for (int n = 0; n < N; ++n) {
		int nums[4]; cin >> nums[0] >> nums[1] >> nums[2]; nums[3] = 1;
		for (int p = 0; p <= P; ++p) {
			if (dp1[p] == INF) continue;
			for (int i = 0; i < 4; ++i) {
				dp2[p + i] = min(dp2[p + i], dp1[p] + nums[i]);
			}
		}
		for (int i = 0; i <= P; ++i) {
			dp1[i] = dp2[i];
			dp2[i] = INF;
		}
	}
	printf("%.15lf\n", (ld)dp1[P] / (ld)N);
	return 0;
}
0