結果

問題 No.472 平均順位
ユーザー nanophoto12nanophoto12
提出日時 2017-01-01 20:17:07
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,262 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 98,640 KB
実行使用メモリ 590,048 KB
最終ジャッジ日時 2023-08-22 09:14:32
合計ジャッジ時間 4,619 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 7 ms
6,812 KB
testcase_09 AC 24 ms
19,252 KB
testcase_10 AC 16 ms
13,272 KB
testcase_11 AC 67 ms
53,372 KB
testcase_12 AC 48 ms
38,396 KB
testcase_13 AC 179 ms
134,076 KB
testcase_14 MLE -
testcase_15 AC 177 ms
134,068 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 48 ms
37,804 KB
testcase_19 AC 87 ms
65,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define pll pair<double,ll>

vector<vector<ll>> dp;

int main()
{
    int n, p;
    cin >> n >> p;
    vector<int> as[4];
    for(int i = 0;i < 4;i++)
    {
        as[i].resize(n);
    }
    for(int i = 0;i < n;i++)
    {
        cin >> as[0][i] >> as[1][i] >> as[2][i];
        as[3][i] = 1;
    }
    dp.resize(n+1);
    for(int i = 0;i < n+1;i++)
    {
        dp[i].resize(p+1);
        fill(dp[i].begin(), dp[i].end(), (ll)1e12);
    }
    fill(dp[0].begin(), dp[0].end(), 0);
    for(int i = 0;i < n;i++)
    {
        for(int w = 0; w < 4;w++)
        {
            ll c = as[w][i];
            for(int j = w;j <= p;j++)
            {
                dp[i+1][j-w] = min(dp[i+1][j-w], c + dp[i][j]);
            }
        }
    }
    ll minc = 1e12;
    for(int i = 0;i <= p;i++)
    {
        minc = min(minc, dp[n][i]);
    }
    cout << fixed << setprecision(8);
    cout << minc / (double)n << endl;
    return 0;
}
0