제출 #261522

#제출 시각아이디문제언어결과실행 시간메모리
261522amallaRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
91 ms5112 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 false; return true; } 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+1); S[0] = {1,1}; for (int i = 1; i<=n; ++i) { S[i].first = s[i]; S[i].second = t[i]; } sort(S.begin()+1, S.end(), costume_sort); for (int i = 0; i<=n; ++i) { if (S[i-1].second>S[i].first) need += curr_speed-S[i].first; } return need; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...