Submission #110524

#TimeUsernameProblemLanguageResultExecution timeMemory
110524Mamnoon_SiamRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
164 ms27256 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll dp[17][1 << 16]; int n; vector<int> s, t; ll f(int u, int mask) { if(mask == (1 << n) - 1) return 0; ll &ret = dp[u][mask]; if(ret != -1) return ret; ret = LLONG_MAX; for(int i = 0; i < n; i++) if(mask & (1 << i)) {} else { ret = min(ret, max(0, t[u] - s[i]) + f(i, mask | (1 << i))); } return ret; } ll plan_roller_coaster(vector<int> _s, vector<int> _t) { s = _s, t = _t; n = (int) s.size(); memset(dp, -1, sizeof dp); ll ret = LLONG_MAX; for(int i = 0; i < n; i++) { ret = min(ret, f(i, 1 << i)); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...