結果

問題 No.472 平均順位
ユーザー nenuonnenuon
提出日時 2018-03-02 18:06:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,196 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 95,908 KB
実行使用メモリ 296,912 KB
最終ジャッジ日時 2023-09-02 11:03:38
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 5 ms
11,792 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 4 ms
7,664 KB
testcase_07 AC 5 ms
11,752 KB
testcase_08 AC 14 ms
30,212 KB
testcase_09 AC 31 ms
62,952 KB
testcase_10 AC 32 ms
77,348 KB
testcase_11 AC 67 ms
116,148 KB
testcase_12 AC 57 ms
108,080 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 AC 45 ms
75,216 KB
testcase_19 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int dp[5005][15005]; // := i+1日めで正解数がjの時の順位の和の最小
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, P; cin >> N >> P;
  FOR(i,0,N+1) FOR(j,0,15005) dp[i][j] = 2e9;
  dp[0][0] = 0;
  int a[N], b[N], c[N];
  FOR(i,0,N) cin >> a[i] >> b[i] >> c[i];
  FOR(i,0,N) {
    FOR(j,0,P+1) {
      // 0問
      dp[i+1][j] = min(dp[i+1][j], dp[i][j] + a[i]); 
      // 1問
      if(j+1<=P) dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + b[i]);
      // 2問
      if(j+2<=P) dp[i+1][j+2] = min(dp[i+1][j+2], dp[i][j] + c[i]);
      // 3問
      if(j+3<=P) dp[i+1][j+3] = min(dp[i+1][j+3], dp[i][j] + 1);
    }
  }
  cout << fixed << setprecision(17) << (double)dp[N][P] / N << endl;
  return 0;
}
0