結果

問題 No.472 平均順位
ユーザー eQeeQe
提出日時 2019-01-16 21:23:38
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,145 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 73,244 KB
実行使用メモリ 601,632 KB
最終ジャッジ日時 2023-09-11 02:28:28
合計ジャッジ時間 8,236 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll N, P;
    cin >> N >> P;
    ll i, j;
    ll a[5050], b[5050], c[5050];
    ll dp[5050][5050*3]={};
    
    for(i=0; i<N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    for(i=0; i<N; i++) {
        for(j=0; j<=P; j++) {
            chmin(dp[i+1][j], dp[i][j]+a[i]);
            chmin(dp[i+1][j+1], dp[i][j]+b[i]);
            chmin(dp[i+1][j+2], dp[i][j]+c[i]);
            chmin(dp[i+1][j+3], dp[i][j]+1);
        }
    }
    
    pt((double)(dp[N][P])/N);
    
}


0