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 "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(), curr_speed = 1, need = 0;
vector<pair<int,int> > S(n);
for (int i = 0; i<n; ++i) {
S[i].first = s[i];
S[i].second = t[i];
}
sort(S.begin(), S.end());
for (int i = 0; i<n; ++i) {
if (curr_speed>S[i].first) need += curr_speed-S[i].second;
curr_speed = S[i].second;
}
return need;
}
# | 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... |