結果

問題 No.472 平均順位
ユーザー aonek0
提出日時 2019-08-24 14:58:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 1,182 bytes
コンパイル時間 966 ms
コンパイル使用メモリ 94,696 KB
実行使用メモリ 589,824 KB
最終ジャッジ日時 2024-10-14 12:47:19
合計ジャッジ時間 4,051 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 MLE * 3
権限があれば一括ダウンロードができます

ソースコード

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;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0