結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2017-12-09 23:39:11 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 916 ms / 2,000 ms |
コード長 | 940 bytes |
コンパイル時間 | 592 ms |
コンパイル使用メモリ | 66,452 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 05:33:12 |
合計ジャッジ時間 | 5,063 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <iostream>#include <algorithm>#include <cmath>#include <cstdlib>#include <vector>#include <queue>#include <utility>using namespace std;typedef long long ll;typedef pair<int, int> P;#define For(i, a, b) for(int i = (a); i < (b); i++)#define Rep(i, n) For(i, 0, (n))#define Rrep(i, n) for(int i = (n); i >= 0; i--)#define pb push_backconst int inf = 999999999;const int mod = 1000000007;const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};int dp[2][20000];int main(){int n, p; cin >> n >> p;int q[n][4];Rep(i, n){cin >> q[i][0] >> q[i][1] >> q[i][2];q[i][3] = 1;}Rep(i, 2) Rep(j, 20000) dp[i][j] = inf;dp[0][0] = 0;Rep(i, n){Rep(j, p + 1) Rep(k, 4){if(j + k <= p){dp[1][j + k] = min(dp[1][j + k], dp[0][j] + q[i][k]);}}Rep(j, p + 1){dp[0][j] = dp[1][j];dp[1][j] = inf;}}double ans = (double)dp[0][p] / (double)n;printf("%.9f\n", ans);return 0;}