Submission #757266

#TimeUsernameProblemLanguageResultExecution timeMemory
757266SebRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
492 ms8596 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e10; ll ans = INF; bool vis[16]; vector <int> v,S,T; ll n; void checkeo() { ll aux=0; for (int i=1;i<n;i++) aux += max(T[v[i-1]]-S[v[i]],0); ans = min(ans,aux); return; } void imprime() { for (int i=0;i<n;i++) cout<<v[i]<<" "; cout<<'\n'; return; } void bruta() { if (!v.empty() && v.size()==n) { checkeo(); imprime(); return; } for (int i=0;i<n;i++) if (vis[i]==false) { v.push_back(i); vis[i] = true; bruta(); v.pop_back(); vis[i] = false; } return; } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n = (int) s.size(); swap(S,s); swap(T,t); bruta(); return ans; }

Compilation message (stderr)

railroad.cpp: In function 'void bruta()':
railroad.cpp:30:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   30 |     if (!v.empty() && v.size()==n) {
      |                       ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...