結果

問題 No.472 平均順位
ユーザー Yuki InoueYuki Inoue
提出日時 2023-12-18 20:36:39
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 3,049 ms
コンパイル使用メモリ 250,864 KB
実行使用メモリ 589,952 KB
最終ジャッジ日時 2023-12-18 20:36:47
合計ジャッジ時間 7,094 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int N, P;
    cin >> N >> P;
    ll rank[N+1][3];
    ll a, b, c;
    rep(i,1,N+1){
        cin >> a >> b >> c;
        rank[i][0] = a;
        rank[i][1] = b;
        rank[i][2] = c;
    }
    
    vector<vector<ll> > dp(N+1, vector<ll>(P+1, 1e18));
    dp[0][0] = 0;
    rep(i,1,N+1) rep(j,0,P+1) rep(k,0,3){
        if(j-k>=0){
            dp[i][j] = min(dp[i-1][j-k] + rank[i][k], dp[i][j]);
        }
    }
    
    cout <<  (double)dp[N][P]/(double)N << endl; 
    return 0;   
}
0