結果

問題 No.472 平均順位
ユーザー aonek0aonek0
提出日時 2019-08-24 14:58:40
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,182 bytes
コンパイル時間 898 ms
コンパイル使用メモリ 96,108 KB
実行使用メモリ 590,092 KB
最終ジャッジ日時 2024-04-22 13:19:06
合計ジャッジ時間 3,843 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 7 ms
8,576 KB
testcase_09 AC 22 ms
23,168 KB
testcase_10 AC 16 ms
18,176 KB
testcase_11 AC 61 ms
60,800 KB
testcase_12 AC 44 ms
45,696 KB
testcase_13 AC 157 ms
153,856 KB
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 42 ms
42,496 KB
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include <assert.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
#include <climits>
using namespace std;
typedef unsigned long long ull;
#define ll long long int
ll mod = 1000000007;
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;




ll a[5003], b[5003], c[5003],dp[5003][15004];

int main() {
	ll n, p;
	cin >> n >> p;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= p; j++) {
			dp[i][j] = 10000000000000000;
		}
	}
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= p; j++) {
			dp[i][j] = dp[i - 1][j]+a[i];
			if(j-1>=0)dp[i][j] = min(dp[i][j], dp[i - 1][j - 1]+b[i]);
			if(j-2>=0)dp[i][j] = min(dp[i][j], dp[i - 1][j - 2]+c[i]);
			if (j - 3 >= 0)dp[i][j] = min(dp[i][j], dp[i - 1][j - 3] + 1);
		}
	}
	long double y=(double)dp[n][p];
	cout << y/n << endl;
}
0