Submission #958834

#TimeUsernameProblemLanguageResultExecution timeMemory
958834MinaRagy06Roller Coaster Railroad (IOI16_railroad)C++17
34 / 100
440 ms524288 KiB
#include <bits/stdc++.h> #include "railroad.h" #ifdef MINA #include "grader.cpp" #endif using namespace std; #define ll long long const int inf = 1e9; ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); ll dp[1 << n][n]; memset(dp, '?', sizeof dp); memset(dp[(1 << n) - 1], 0, sizeof dp[(1 << n) - 1]); for (int msk = (1 << n) - 2; msk >= 0; msk--) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if ((msk >> j) & 1) continue; dp[msk][i] = min(dp[msk][i], dp[msk | (1 << j)][j] + max(0, (msk? t[i] - s[j] : 0))); } } } return dp[0][0]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...