結果

問題 No.472 平均順位
ユーザー DugongDugong
提出日時 2017-03-16 23:07:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 39,300 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 05:24:05
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<algorithm>
using namespace std;

const int INF = 1000000000;

int main(){
	int n,p;
	int rnk[5000][4];
	int dp[15001];
	scanf("%d %d",&n,&p);
	for(int i=0;i<n;i++){
		scanf("%d %d %d",&rnk[i][0],&rnk[i][1],&rnk[i][2]);
		rnk[i][3] = 1;
	}
	fill(dp,dp+p,INF);
	dp[p] = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=p;j++){
			dp[j] += rnk[i][0];
			for(int k=1;k<=3&&j+k<=p;k++){
				dp[j] = min(dp[j],dp[j+k]+rnk[i][k]);
			}
		}
	}
	printf("%.1f\n",(double)dp[0]/n);
	return 0;
}
0