結果
| 問題 |
No.472 平均順位
|
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2018-03-02 18:19:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 191 ms / 2,000 ms |
| コード長 | 1,121 bytes |
| コンパイル時間 | 827 ms |
| コンパイル使用メモリ | 96,496 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-11 18:23:52 |
| 合計ジャッジ時間 | 2,342 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#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[15005]; // := i+1日めで正解数がjの時の順位の和の最小
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int N, P; cin >> N >> P;
FOR(j,0,15005) dp[j] = 2e9;
dp[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(int j = P; j >= 0; j--) {
// 0問
dp[j] = dp[j] + a[i];
// 1問
if(j-1>=0) dp[j] = min(dp[j], dp[j-1] + b[i]);
// 2問
if(j-2>=0) dp[j] = min(dp[j], dp[j-2] + c[i]);
// 3問
if(j-3>=0) dp[j] = min(dp[j], dp[j-3] + 1);
}
}
cout << fixed << setprecision(17) << (double)dp[P] / N << endl;
return 0;
}
nenuon