This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "railroad.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
long long n,m,T,k,ans;
long long dp[2000005][20];
long long plan_roller_coaster(vector<int> S, vector<int> T) {
ans=1e18; n=S.size();
for (int mask=0; mask<(1<<n); mask++) {
for (int i=0; i<n; i++) {
if (!(mask&(1<<i))) continue;
if (mask==(1<<i)) continue;
long long val=1e18;
for (int j=0; j<n; j++) {
if (i==j) continue;
if (mask&(1<<j)) val=min(val,dp[mask-(1<<i)][j]+max(0,T[i]-S[j]));
}
dp[mask][i]=val;
}
}
for (int i=0; i<n; i++) ans=min(ans,dp[(1<<n)-1][i]);
return ans;
}
Compilation message (stderr)
railroad.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |