Submission #600480

#TimeUsernameProblemLanguageResultExecution timeMemory
600480A_DRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
98 ms7608 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(vector<int> s,vector<int> t){ int n = (int) s.size(); vector<pair<int,int>> s2; vector<int> vec; for(int i=0;i<n;i++){ vec.push_back(0); if(t[i]<=s[i])vec[i]--; s2.push_back({t[i],i}); } sort(s.begin(),s.end()); reverse(s.begin(),s.end()); sort(s2.begin(),s2.end()); for(int i=0;i<n;i++){ int l=0,r=n-1,h=s2[i].first,ans=-1; while(l<=r){ int mid=(l+r)/2; if(s[mid]>=h){ ans=mid; l=mid+1; } else{ r=mid-1; } } vec[s2[i].second]+=ans; } sort(vec.begin(),vec.end()); for(int i=0;i<n;i++){ if(vec[i]<i)return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...