This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll plan_roller_coaster (vector<int> s, vector<int> t){
ll n = s.size();
set<pair<int, int>> st;
for (int i=0; i<n; i++)
st.insert({s[i], i});
pair<int, int> last = {-1, -1};
ll can = 1;
while (st.size()){
auto lb = st.lower_bound(last);
if (lb == st.end()){
can = 0;
break;
}
last = *lb;
last.first = t[last.second];
last.second = -1;
st.erase(lb);
}
return can;
}
// int main(){
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |