結果

問題 No.472 平均順位
ユーザー Hoi_koroHoi_koro
提出日時 2016-12-22 02:33:38
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 1,563 bytes
コンパイル時間 2,653 ms
コンパイル使用メモリ 115,128 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-22 15:04:09
合計ジャッジ時間 6,095 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 14 ms
4,376 KB
testcase_10 AC 21 ms
4,376 KB
testcase_11 AC 48 ms
4,376 KB
testcase_12 AC 42 ms
4,380 KB
testcase_13 AC 322 ms
4,380 KB
testcase_14 AC 323 ms
4,376 KB
testcase_15 AC 322 ms
4,380 KB
testcase_16 AC 323 ms
4,376 KB
testcase_17 AC 323 ms
4,380 KB
testcase_18 AC 21 ms
4,380 KB
testcase_19 AC 291 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define debug(a) cerr<<#a <<' '<< a <<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
typedef pair<int,int>PI; typedef vector<int> VI;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,p;
    cin >> n >> p;
    vector<VI> improve(n,VI(4));
    double ans=0;
    REP(i,n){
        int a[4];
        cin >>  a[0] >> a[1]>> a[2];
        a[3]=1;
        FOR(j,1,4) improve[i][j]=-a[j]+a[0];
        ans+=a[0];
    }
    VI dp(3*n+1);
    REP(i,n){
        for(int j=3*n; j>=1; --j){
            FOR(k,1,4){
                if(j-k>=0)dp[j]=max(dp[j],dp[j-k]+improve[i][k]);
            }
        }
    }
    cout << fixed<<setprecision(10)<<(ans-dp[p])/(double)n<<endl;

    return 0;
}
0