Submission #138397

#TimeUsernameProblemLanguageResultExecution timeMemory
138397arthurconmyRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
142 ms6888 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<n; i++) { if(vals[i] > i) offences++; } if(offences>1) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...