Submission #73004

#TimeUsernameProblemLanguageResultExecution timeMemory
73004KmcodeRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
167 ms7756 KiB
#include<bits/stdc++.h> using namespace std; //#include "railroad.h" vector<pair<int,int> > v; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); for(int i=0;i<n;i++){ v.push_back(make_pair(s[i],1)); v.push_back(make_pair(t[i],0)); } sort(v.begin(),v.end()); reverse(v.begin(),v.end()); bool ok=false; int stk=0; int en=0; for(int i=0;i<v.size();i++){ if(v[i].second==1){ stk++; } else{ if(stk){ stk--; continue; } if(stk==0){ if(en==0){ en=1; break; } ok=true; break; } } } return ok; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:18:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.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...