Submission #297871

#TimeUsernameProblemLanguageResultExecution timeMemory
297871MuhammetaliRoller Coaster Railroad (IOI16_railroad)C++11
11 / 100
2086 ms13540 KiB
#include "railroad.h" #include <bits/stdc++.h> #define mp make_pair #define f first #define s second #define sz(x) (int)(x).size() #define rsz resize #define ins insert #define ft front() #define bk back() #define pf push_front #define pb push_back #define eb emplace_back #define lb lower_bound #define ub upper_bound using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pl; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; ll res=100000000000000; vpi par,rap; vi v; bool vis[200]; void func(int n,ll speed,int k,ll jem) { if (k==n) { res=min(res,jem); return; } for (int i=0;i<n;i++) { if (!vis[i]) { vis[i]=1; v.pb(i); func(n,par[i].s,k+1,jem+((speed>par[i].f)?speed-par[i].f:0)); v.pop_back(); vis[i]=0; } } } ll plan_roller_coaster(vi s,vi t) { for (int i=0;i<sz(s);i++) par.pb({s[i],t[i]}); for (int i=0;i<sz(s);i++) rap.pb({s[i],i}); sort(par.begin(),par.end()); sort(rap.begin(),rap.end()); func(sz(s),1,0,0); 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...