結果

問題 No.472 平均順位
ユーザー zuvizudarzuvizudar
提出日時 2017-11-03 02:31:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 1,166 bytes
コンパイル時間 1,753 ms
コンパイル使用メモリ 88,404 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 04:03:36
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 26 ms
5,376 KB
testcase_10 AC 27 ms
5,376 KB
testcase_11 AC 63 ms
5,376 KB
testcase_12 AC 52 ms
5,376 KB
testcase_13 AC 180 ms
5,376 KB
testcase_14 AC 383 ms
5,376 KB
testcase_15 AC 181 ms
5,376 KB
testcase_16 AC 427 ms
5,376 KB
testcase_17 AC 446 ms
5,376 KB
testcase_18 AC 41 ms
5,376 KB
testcase_19 AC 132 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define INF 1<<30
 
typedef long long ll;

int dy[8]={1,1,1,0,0,-1,-1,-1};
int dx[8]={-1,0,1,-1,1,-1,0,1};
struct S{
	int a,b,c;
};
bool asc(const S& left,const S& right){
	return left.c > right.c;
};
int n,p;
//int dp[5001][15001];
ll be[15001],af[15001];

int main(int argc, char const *argv[]) {
	cin >> n >> p;
	rep(i,3*n+1)be[i]=INF;
	be[p]=0;
	rep(i, n) {
		rep(j,3*n+1)af[j]=INF;
		int v[4];
		rep(k, 3) cin >> v[k];
		v[3] = 1;
		rep(j,p+1){
			rep(k,4){
				if(j>=k){
					af[j-k]=min(af[j-k],be[j]+v[k]);
				}
			}
		}
		swap(be,af);
	}
	printf("%.10lf\n", be[0]/(double)n);
	return 0;
}
0