結果

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

テストケース

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

ソースコード

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][4];
    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;
        rank[i][3] = 1;
    }
    
    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,4){
        if(j-k>=0){
            dp[i][j] = min(dp[i-1][j-k] + rank[i][k], dp[i][j]);
        }
    }
    rep(i,0,N+1) rep(j,0,P+1) cout << dp[i][j] << endl;
    cout <<  (double)dp[N][P]/(double)N << endl; 
    return 0;   
}
0