제출 #1020689

#제출 시각아이디문제언어결과실행 시간메모리
1020689vjudge1Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
424 ms48720 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define pii pair<int, int> #define ff first #define ss second #define popcnt __builtin_popcount #define mp make_pair pii a[200100]; long long plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); multiset<pii> l, r; for(int i=0; i<n; i++){ l.insert({s[i], t[i]}); r.insert({t[i], s[i]}); } while(l.size() > 1){ pii x = *l.begin(); auto it = r.lower_bound(mp(x.ff,1e18)); if(it == r.begin()) return 1; it--; pii y = *it; y = mp(y.ss, y.ff); r.erase(it); r.erase(r.find(mp(x.ss, x.ff))); l.erase(l.begin()); l.erase(l.find(y)); l.insert({y.ff, x.ss}); r.insert({x.ss, y.ff}); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...