Submission #410834

#TimeUsernameProblemLanguageResultExecution timeMemory
410834EJOI2019AndrewRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2096 ms8376 KiB
#include "railroad.h" #include<bits/stdc++.h> #define ll long long int #define vi vector<int> #define pb push_back using namespace std; long long plan_roller_coaster(vector<int> s,vector<int> t) { int n=(int)s.size(); ll res=1e18; vi a; for(int i=0;i<n;i++) a.pb(i); do{ ll G=0,c=0; for(int i=0;i<n;i++) { if(c>s[a[i]]) G+=(c-s[a[i]]); c=t[a[i]]; } res=min(res,G); }while(next_permutation(a.begin(),a.end())); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...