結果

問題 No.472 平均順位
ユーザー fiordfiord
提出日時 2017-08-14 17:40:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,692 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 94,152 KB
実行使用メモリ 297,072 KB
最終ジャッジ日時 2024-04-21 11:25:29
合計ジャッジ時間 3,095 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 5 ms
6,912 KB
testcase_09 AC 16 ms
15,360 KB
testcase_10 AC 13 ms
13,312 KB
testcase_11 AC 45 ms
35,840 KB
testcase_12 AC 35 ms
28,032 KB
testcase_13 AC 133 ms
88,704 KB
testcase_14 MLE -
testcase_15 AC 131 ms
88,960 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 29 ms
25,728 KB
testcase_19 AC 75 ms
53,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define fst	first
#define scn second
#define bicnt(x)	__buildin__popcount(x)
#define debug(x)	cout<<"debug: "<<x<<endl
#define DEBUG 0

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 0,1,0,-1 };
const int dy[] = { 1,0,-1,0 };

int dp[5010][15010];

int main() {
	int n, p;	cin >> n >> p;
	REP(i, n)	REP(j, p)	dp[i][j] = inf;
	dp[0][0] = 0;
	rep(i, n) {
		int a, b, c;	cin >> a >> b >> c;
		REP(j, p) {
			if (dp[i][j] == inf)	continue;
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + a);
			if (j + 1 <= p)	dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + b);
			if (j + 2 <= p)	dp[i + 1][j + 2] = min(dp[i + 1][j + 2], dp[i][j] + c);
			if (j + 3 <= p)	dp[i + 1][j + 3] = min(dp[i + 1][j + 3], dp[i][j] + 1);
		}
	}
	printf("%.15Lf\n", ((ld)dp[n][p]) / ((ld)n) + eps);
	return 0;
}
0