結果

問題 No.472 平均順位
ユーザー tactac
提出日時 2019-05-05 17:30:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,493 ms / 2,000 ms
コード長 1,121 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 100,160 KB
実行使用メモリ 169,824 KB
最終ジャッジ日時 2023-09-07 12:28:16
合計ジャッジ時間 7,851 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,504 KB
testcase_08 AC 9 ms
6,404 KB
testcase_09 AC 36 ms
12,908 KB
testcase_10 AC 32 ms
12,824 KB
testcase_11 AC 114 ms
28,768 KB
testcase_12 AC 87 ms
24,020 KB
testcase_13 AC 374 ms
81,732 KB
testcase_14 AC 1,414 ms
165,632 KB
testcase_15 AC 375 ms
81,756 KB
testcase_16 AC 1,476 ms
169,824 KB
testcase_17 AC 1,493 ms
169,768 KB
testcase_18 AC 58 ms
17,076 KB
testcase_19 AC 192 ms
52,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<climits>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int v[5000][4], n;
int memo[5000][15001];
int dfs(int d, int r){
    if (d == n) return 0;
    if (!memo[d][r]){
        memo[d][r] = inf;
        //int rem = (n - d) * 3;
        /*if ( rem >= r)*/
        for (int i = 0; i <= (r < 3 ? r : 3); i++) chmin(memo[d][r], dfs(d + 1, r - i) + v[d][i]);
    }
    return memo[d][r];
}
int main(){
    int k;
    cin >> n >> k;
    for(int i = 0; i < n; v[i][3] = 1, i++) rep(j, 3) cin >> v[i][j];
    cout << dfs(0, k) * 1.0 / n << endl;
}
0