結果

問題 No.472 平均順位
ユーザー jimmyo0705jimmyo0705
提出日時 2018-09-25 13:13:41
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 1,647 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 91,824 KB
実行使用メモリ 590,000 KB
最終ジャッジ日時 2024-04-15 00:37:58
合計ジャッジ時間 7,375 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n,p;
double C[5001][4];
double dp[5001][3*5000+1];

int main(){
	cin >> n >> p;
	rep(i,n){
		cin >> C[i][0] >> C[i][1] >> C[i][2];
		C[i][3] = 1;
	}
	rep(i,5001)rep(j,3*5000+1)dp[i][j] = INF;
	rep(i,4)dp[1][i] = C[0][i];
	FOR(i,1,n){
		rep(j,p+1){
			rep(k,4){
				dp[i+1][j+k] = min(dp[i+1][j+k],(dp[i][j]+C[i][k])/2);
			}
		}
	}
	cout << dp[n][p] << endl;
}
0