結果

問題 No.472 平均順位
ユーザー eQeeQe
提出日時 2019-01-16 21:27:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,160 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 73,144 KB
実行使用メモリ 5,200 KB
最終ジャッジ日時 2023-09-11 02:30:25
合計ジャッジ時間 2,725 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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[N+5], b[N+5], c[N+5];
    ll dp[P+5];
    
    
    for(i=0; i<N; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    
    for(j=0; j<=P; j++)
        dp[j]=INF;
    
    dp[0]=0;
    for(i=0; i<N; i++) {
        for(j=0; j<=P; j++) {
            chmin(dp[j], dp[j]+a[i]);
            chmin(dp[j+1], dp[j]+b[i]);
            chmin(dp[j+2], dp[j]+c[i]);
            chmin(dp[j+3], dp[j]+1);
        }
    }
    
    pt((double)(dp[P])/N);
    
}

0