結果

問題 No.472 平均順位
ユーザー tomoishtomoish
提出日時 2020-01-09 01:12:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 2,321 bytes
コンパイル時間 1,535 ms
コンパイル使用メモリ 165,072 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 01:03:31
合計ジャッジ時間 3,318 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 9 ms
4,380 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 25 ms
4,376 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 72 ms
4,380 KB
testcase_14 AC 193 ms
4,376 KB
testcase_15 AC 71 ms
4,380 KB
testcase_16 AC 206 ms
4,380 KB
testcase_17 AC 182 ms
4,380 KB
testcase_18 AC 14 ms
4,376 KB
testcase_19 AC 37 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



ll dp[15010];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;

    ll n,p;
    cin>>n>>p;
    ll a[5010][4];
    rep(i,n){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
        a[i][3]=1;
    }
    rep(j,15010) dp[j]=LLINF;
    dp[0]=0;
    rep(i,n){
        repr(j,p+1){
            if(dp[j]==LLINF) continue;
            repr(k,4){
                if(k==0) dp[j]=dp[j]+a[i][0];
                chmin(dp[j+k],dp[j]+a[i][k]);
            }
        }
    }
    cout<<(double)dp[p]/(double)n<<endl;
    return 0;
}
0