結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2019-01-16 21:39:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,243 bytes |
コンパイル時間 | 951 ms |
コンパイル使用メモリ | 78,248 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 17:03:29 |
合計ジャッジ時間 | 2,213 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 1 WA * 15 |
ソースコード
#include <iostream>#include <cmath>#include <string>#include <algorithm>#include <set>#include <vector>#include <map>#include <list>#include <stack>#include <cstdio>#include <cstring>#include <cstdlib>#include <queue>#define mkp make_pair#define fi first#define se second#define pt(num) cout << num << "\n"#define max(a, b) ((a)>(b) ? (a):(b))#define min(a, b) ((a)<(b) ? (a):(b))#define chmax(a, b) (a<b ? a=b : 0)#define chmin(a, b) (a>b ? a=b : 0)#define INF 1000000000000000000#define MOD 1000000007LL#define MAX 101010using namespace std;typedef long long ll;typedef pair<ll, ll> P;typedef map<ll, ll> Map;int main(void) {ll N, P;cin >> N >> P;ll i, j;ll a[N+5], b[N+5], c[N+5];ll dp[P+5];for(i=0; i<N; i++) {cin >> a[i] >> b[i] >> c[i];}for(j=0; j<=P; j++) {dp[j]=INF;}dp[0]=0;for(i=0; i<N; i++) {for(j=P; j>=0; j--) {chmin(dp[j], dp[j]+a[i]);if(j>=1)chmin(dp[j], dp[j-1]+b[i]);if(j>=2)chmin(dp[j], dp[j-2]+c[i]);if(j>=3)chmin(dp[j], dp[j-3]+1);}}pt((double)(dp[P])/N);}