Submission #261520

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2615202020-08-11 20:13:33amallaRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
263 ms9980 KiB
#include "railroad.h"
#include<bits/stdc++.h>
using namespace std;
bool costume_sort(pair<int,int> a, pair<int,int> b) {
if (a.second-b.first<b.first-a.second) return true;
return false;
}
long long plan_roller_coaster(vector<int> s, vector<int> t) {
long long n = (long long) 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(), costume_sort);
for (int i = 0; i<n; ++i) {
if (curr_speed>S[i].first) need += curr_speed-S[i].first;
curr_speed = S[i].second;
}
return need;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...