結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2020-01-09 01:12:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 216 ms / 2,000 ms |
コード長 | 2,321 bytes |
コンパイル時間 | 1,676 ms |
コンパイル使用メモリ | 167,688 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-23 03:33:21 |
合計ジャッジ時間 | 2,851 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
// #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; }