Submission #600138

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6001382022-07-20 13:31:24HazemRoller Coaster Railroad (IOI16_railroad)C++14
34 / 100
44 ms10560 KiB
#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18;
long long dp[100000][20];
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
for(int i=0;i<(1<<n);i++)
for(int j=0;j<n;j++)
dp[i][j] = LINF;
for(int i=0;i<n;i++)
dp[1<<i][i] = 0;
for(int i=0;i<(1<<n);i++)
for(int j=0;j<n;j++){
if(!((1<<j)&i))
continue;
for(int k=0;k<n;k++)
if(!((1<<k)&i))
dp[i|(1<<k)][k] = min(dp[i|(1<<k)][k],dp[i][j]+max(0,t[j]-s[k]));
}
long long ans = LINF;
for(int i=0;i<n;i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...