Submission #591546

#TimeUsernameProblemLanguageResultExecution timeMemory
591546AlperenTRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
60 ms8492 KiB
#include <bits/stdc++.h> #include "railroad.h" using namespace std; const long long INF = 2e18; long long plan_roller_coaster(vector<int> s, vector<int> t){ int n = (int)s.size(); if(n <= 16){ long long dist[1 << n][n]; for(int m = 0; m < (1 << n); m++) fill(dist[m], dist[m] + n, INF); for(int i = 0; i < n; i++) dist[1 << i][i] = 0; for(int m = 1; m < (1 << n); m++){ for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(!(m & (1 << j))){ dist[m | (1 << j)][j] = min(dist[m | (1 << j)][j], dist[m][i] + max(0, t[i] - s[j])); } } } } return *min_element(dist[(1 << n) - 1], dist[(1 << n) - 1] + n); } return 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...