제출 #593744

#제출 시각아이디문제언어결과실행 시간메모리
593744Valaki2Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
87 ms18732 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pii pair<int, int> #define mp make_pair #define fi first #define se second const int inf = 1e16 + 42; int n; vector<int> in; vector<int> out; bool solve() { vector<pii > events; for(int i = 0; i < n; i++) { events.pb(mp(out[i], 1)); events.pb(mp(in[i], -1)); } sort(events.rbegin(), events.rend()); int cnt = 0; bool was = false; for(pii p : events) { if(p.se == 1) { cnt++; } else { if(cnt > 0) { cnt--; } else { if(was) { return true; } else { was = true; } } } } return false; } int plan_roller_coaster(vector<signed> s, vector<signed> t) { n = (int) s.size(); in.assign(n, 0); out.assign(n, 0); for(int i = 0; i < n; i++) { in[i] = s[i]; out[i] = t[i]; } return (int) solve(); } /* 8 0 3 1 5 2 4 3 0 4 2 5 4 6 7 7 5 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...