Submission #757267

#TimeUsernameProblemLanguageResultExecution timeMemory
757267SebRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2060 ms8476 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 bruta() { if (!v.empty() && v.size()==n) { checkeo(); 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:24: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]
   24 |     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...