Submission #138395

#TimeUsernameProblemLanguageResultExecution timeMemory
138395arthurconmyRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
154 ms10876 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "railroad.h" #endif using namespace std; using ll=long long; const int MAXN = 200000; ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); vector<pair<int,int>> TS; for(int i=0; i<n; i++) { TS.push_back({t[i],s[i]}); } sort(TS.begin(),TS.end()); vector<int> vals; for(int i=0; i<n; i++) { int k = lower_bound(TS.begin(),TS.end(),make_pair(TS[i].second,0)) - TS.begin(); // if(TS[0].first > TS[i].second) vals.push_back(-1); vals.push_back(k); } sort(vals.begin(),vals.end()); int offences=0; for(int i=0; i<vals.size(); i++) { if(vals[i] < i) offences++; } if(offences>1) return 1; return 0; }

Compilation message (stderr)

railroad.cpp: In function 'll plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:36:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<vals.size(); i++)
               ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...