結果

問題 No.472 平均順位
ユーザー furafura
提出日時 2020-06-10 10:15:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 2,882 ms
コンパイル使用メモリ 197,916 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-04 06:45:03
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1<<29;

int main(){
	int n,m; scanf("%d%d",&n,&m);

	int dp[2][15001];
	rep(j,m+1) dp[0][j]=(j==m?0:INF);
	rep(i,n){
		int a[4];
		rep(k,3) scanf("%d",&a[k]);
		a[3]=1;

		int curr=i%2,next=(i+1)%2;
		rep(j,m+1) dp[next][j]=INF;
		rep(j,m+1) rep(k,4) if(j>=k) dp[next][j-k]=min(dp[next][j-k],dp[curr][j]+a[k]);
		rep(j,m+1) dp[curr][j]=dp[next][j];
	}

	printf("%.9f\n",1.0**min_element(dp[n%2],dp[n%2]+m+1)/n);

	return 0;
}
0