結果
問題 | No.472 平均順位 |
ユーザー |
|
提出日時 | 2022-03-25 13:25:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 2,740 bytes |
コンパイル時間 | 2,195 ms |
コンパイル使用メモリ | 206,416 KB |
最終ジャッジ日時 | 2025-01-28 11:19:56 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 MLE * 2 |
ソースコード
#if !__INCLUDE_LEVEL__#include __FILE__int main() {int n, p;input(n, p);VVI dp(n + 1, VI(p + 1, INT_MAX));dp[0][0] = 0;rep(i, 0, n) {VI d(4, 1);rep(i, 0, 3) input(d[i]);rep(k, 0, 4) {rep(j, 0, p + 1) {if(dp[i][j] != INT_MAX && j + k <= p) {chmin(dp[i + 1][j + k], dp[i][j] + d[k]);}}}}print((double)dp[n][p] / (double)n);return 0;}/*平均順位の出し方最後にNで割れば良いナップザックdp[i][j] : コストがjを超えないように選ぶコストの和をpにしなければならない*/#else#include <bits/stdc++.h>using namespace std;#define _GLIBCXX_DEBUG#define rep(i, j, n) for(int i = j; i < n; i++)#define rrep(i, j, n) for(int i = n - 1; j <= i; i--)#define all(v) v.begin(), v.end()#define rall(v) v.rbegin(), v.rend()#define MOD1 = 998244353;#define MOD2 = 1000000007;using LL = long long;using VI = vector<int>;using VS = vector<string>;using VLL = vector<LL>;using VC = vector<char>;using VD = vector<double>;using VB = vector<bool>;using PII = pair<int, int>;using PSS = pair<string, string>;using PIS = pair<int , string>;using PSI = pair<string, int>;using PLL = pair<LL, LL>;using PCC = pair<char, char>;using VVI = vector<VI>;using VVS = vector<VS>;using VVLL = vector<VLL>;using VVC = vector<VC>;using VVD = vector<VD>;using VPII = vector<PII>;using VPSS = vector<PSS>;using VPIS = vector<PIS>;using VPSI = vector<PSI>;using VPLL = vector<PLL>;template<typename T> bool chmax(T& a, const T &b) { if (a < b) { a = b; return true; } return false; }template<typename T> bool chmin(T& a, const T &b) { if (a > b) { a = b; return true; } return false; }template<class... T> void input(T&... a) { (cin >> ... >> a); }template<class T> void print (const T &a) { cout << a << '\n'; }template<class T, class... Ts> void print(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }LL power(LL n, LL k) { LL res = 1; while(k) if(k & 1) { res *= n; n *= n; k >>= 1; } return res; }LL power_mod(LL n, LL k, LL mod) { LL res = 1; while(k) { if(k & 1) res = res * n % mod; n = n * n % mod; k >>= 1; } return res; }bool is_prime(LL n) { if(n == 1) return 0; for(LL i = 2; i * i <= n; i++) if(n % i == 0) return 0; return 1; }VLL enum_divisors(LL n) { VLL res; for(LL i = 1; i * i <= n; i++) if(n % i == 0) { res.push_back(i); if(n / i != i) res.push_back(n / i); } sort(all(res)); return res; }VPLL prime_factorize(LL n) { VPLL res; for(LL i = 2; i * i <= n; i++) { if(n % i != 0) continue; LL ex = 0; while(n % i == 0) { ex++; n /= i; } res.push_back({i, ex}); } if(n != 1) res.push_back({n, 1}); return res; }#endif