Submission #110522

#TimeUsernameProblemLanguageResultExecution timeMemory
110522Mamnoon_SiamRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
114 ms31184 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 = INT_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 = INT_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...