제출 #206003

#제출 시각아이디문제언어결과실행 시간메모리
206003okoRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2090 ms7032 KiB
#include "railroad.h" #include <cstdio> #include <cassert> #include<bits/stdc++.h> using namespace std; long long n,ans=1e18,sum; vector<int>en,ex; void f(int mask,long long sp) { if(mask==(1<<n)-1)ans=min(ans,sum); for(int i=0;i<n;i++) { if((mask&(1<<i))==0) { long long dis=max(0ll,sp-en[i]); sum+=dis; f(mask|(1<<i),ex[i]); sum-=dis; } } } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n=s.size(); en=s; ex=t; f(0,1); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...