結果

問題 No.472 平均順位
ユーザー けーけー
提出日時 2017-04-11 22:36:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 1,503 ms
コンパイル使用メモリ 166,228 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 11:18:37
合計ジャッジ時間 3,953 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 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,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 28 ms
4,376 KB
testcase_12 AC 21 ms
4,380 KB
testcase_13 AC 77 ms
4,376 KB
testcase_14 AC 244 ms
4,380 KB
testcase_15 AC 78 ms
4,380 KB
testcase_16 AC 275 ms
4,376 KB
testcase_17 AC 279 ms
4,376 KB
testcase_18 AC 19 ms
4,380 KB
testcase_19 AC 41 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
const int inf=8938103643641919514ll;
const int mod=1000000007ll;
const int dd[]={0,-1,0,1,0};
using namespace std;
int a,b,c,d;
int p[5000],q[5000],r[5000],s[2][15001];
signed main(){
	int i,j,k;
	int f=0;
	cin>>a>>b;
	for(i=0;i<a;i++)
		cin>>p[i]>>q[i]>>r[i];
	for(i=0;i<a;i++){
		for(j=0;j<=b;j++)
			s[f^1][j]=s[f][j]+p[i];
		for(j=1;j<=b;j++)
			if(s[f^1][j]>=s[f][j-1]+q[i])
				s[f^1][j]=s[f][j-1]+q[i];
		for(j=2;j<=b;j++)
			if(s[f^1][j]>=s[f][j-2]+r[i])
				s[f^1][j]=s[f][j-2]+r[i];
		for(j=3;j<=b;j++)
			if(s[f^1][j]>=s[f][j-3]+1)
				s[f^1][j]=s[f][j-3]+1;
		f^=1;
	}
	cout<<setprecision(15)<<(double)s[f][b]/a<<endl;
}
0