Submission #88583

#TimeUsernameProblemLanguageResultExecution timeMemory
88583amiratouRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2077 ms13848 KiB
#include "railroad.h" #include <bits/stdc++.h> #define INF LLONG_MAX #define debug(x) cerr << " - " << #x << ": " << x << endl; #define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl; using namespace std; int n; bool used[200003]; vector<int> li,exi; long long solve(long long speed,long long idx,long long rails){ //debug(rails); //debugs(speed,idx); if(speed<=0) return INF; if(idx==n) return rails; long long ans=INF; for (int i = 0; i < n; ++i) { if(!used[i]){ used[i]=1; //debug(i); ans=min(ans,solve(exi[i],idx+1,rails+max(0LL,speed-li[i]))); used[i]=0; } } return ans; } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n = (int) s.size(); li=s; exi=t; return solve(1,0,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...