結果

問題 No.472 平均順位
ユーザー nenuonnenuon
提出日時 2018-03-02 23:39:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,190 bytes
コンパイル時間 808 ms
コンパイル使用メモリ 94,404 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-04 15:14:19
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 from[15005], to[15005]; // := i+1日めで正解数がjの時の順位の和の最小
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, P; cin >> N >> P;
  FOR(j,0,15005) from[j] = to[j] = 2e9;
  from[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) to[j] = 2e9;
    FOR(j,0,P+1) {
      // 0問
      to[j] = min(to[j],from[j]+a[i]);
      // 1問
      if(j+1<=P) to[j+1] = min(to[j+1],from[j]+a[i]);
      // 2問
      if(j+2<=P) to[j+2] = min(to[j+2],from[j]+a[i]);
      // 3問
      if(j+3<=P) to[j+3] = min(to[j+3],from[j]+a[i]);
    }
    swap(from,to);
  }
  cout << fixed << setprecision(17) << (double)from[P] / N << endl;
  return 0;
}
0