結果

問題 No.472 平均順位
ユーザー shossiissohsshossiissohs
提出日時 2018-01-09 18:20:56
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 659 bytes
コンパイル時間 1,135 ms
コンパイル使用メモリ 145,084 KB
実行使用メモリ 296,924 KB
最終ジャッジ日時 2023-08-25 02:22:56
合計ジャッジ時間 4,409 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 3 ms
9,820 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
5,816 KB
testcase_07 AC 3 ms
9,828 KB
testcase_08 AC 9 ms
28,408 KB
testcase_09 AC 26 ms
61,296 KB
testcase_10 AC 24 ms
75,612 KB
testcase_11 AC 60 ms
89,808 KB
testcase_12 AC 47 ms
86,192 KB
testcase_13 AC 152 ms
142,484 KB
testcase_14 MLE -
testcase_15 AC 155 ms
145,588 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 40 ms
73,796 KB
testcase_19 AC 88 ms
119,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int n,p;
int abc[5005][4];
int dp[5005][15005];
const int INF = 1e9;
int main() {
  cin >> n >> p;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3; j++) {
      cin >> abc[i][j];
    }
    abc[i][3] = 1;
  }
  for(int i = 0; i <= n; i++) {
    for(int j = 0; j <=p; j++) {
	dp[i][j]= INF;
      }
    }
  

  dp[0][0] = 0;

  for(int i = 0; i < n; i++) {
    for(int j = 0; j <= p; j++) {
      for(int k = 0; k < 4; k++) {
	if(j + k > p) continue;
	dp[i+1][j+k] = min(dp[i+1][j+k],dp[i][j] + abc[i][k]);
      }
    }
  }

  cout << fixed << setprecision(10) << dp[n][p] / (double)n << endl;
}
  
    
0