結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2019-05-05 17:30:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,706 ms / 2,000 ms |
コード長 | 1,121 bytes |
コンパイル時間 | 879 ms |
コンパイル使用メモリ | 100,692 KB |
実行使用メモリ | 169,984 KB |
最終ジャッジ日時 | 2024-06-25 06:32:57 |
合計ジャッジ時間 | 8,388 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#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;}