제출 #1029670

#제출 시각아이디문제언어결과실행 시간메모리
1029670thinknoexitRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
60 ms9528 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int n; ll plan_roller_coaster(vector<int> s, vector<int> t) { n = (int)s.size(); vector<pair<int, int>> v; for (int i = 0;i < n;i++) v.push_back({ s[i], t[i] }); sort(v.begin(), v.end(), [&](pair<int, int> a, pair<int, int> b) { if (a.second != b.second) return a.second < b.second; return a.first < b.first; } ); int now = 1; ll ans = 0; for (int i = 0;i < n;i++) { //cout << v[i].first << ' ' << v[i].second << '\n'; ans += max(0, now - v[i].first); now = v[i].second; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...