Submission #942378

#TimeUsernameProblemLanguageResultExecution timeMemory
942378Nika533Roller Coaster Railroad (IOI16_railroad)C++14
34 / 100
43 ms10872 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...