Submission #436516

#TimeUsernameProblemLanguageResultExecution timeMemory
436516mohammad_kilaniRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
135 ms11444 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; const int N = 200010; vector< pair< int , int > > arr; int sum[N]; 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++){ arr.push_back(make_pair(s[i] , i)); } sort(arr.begin(),arr.end()); for(int idx , i = 0 ;i < n;i++){ idx = lower_bound(arr.begin(),arr.end(),make_pair(t[i] , 0)) - arr.begin(); sum[idx]++; } int all = 0; vector< int > cur; for(int i = 0 ;i < n;i++){ all += sum[i]; if(t[arr[i].second] <= s[arr[i].second]) cur.push_back(all - 1); else cur.push_back(all); } sort(cur.begin(),cur.end()); for(int i = 0 ;i < (int)cur.size();i++){ if(cur[i] < i) 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...