結果

問題 No.472 平均順位
ユーザー aonek0aonek0
提出日時 2019-08-24 14:58:40
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,182 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 92,212 KB
実行使用メモリ 589,756 KB
最終ジャッジ日時 2023-08-04 15:38:15
合計ジャッジ時間 3,966 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 4 ms
15,916 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
7,624 KB
testcase_07 AC 5 ms
17,996 KB
testcase_08 AC 13 ms
53,068 KB
testcase_09 AC 30 ms
105,144 KB
testcase_10 AC 29 ms
104,856 KB
testcase_11 AC 64 ms
132,488 KB
testcase_12 AC 52 ms
122,432 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 45 ms
145,448 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