Submission #226079

#TimeUsernameProblemLanguageResultExecution timeMemory
226079VEGAnnRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
123 ms11496 KiB
#include <bits/stdc++.h> #include "railroad.h" #define pii pair<int,int> #define MP make_pair #define PB push_back #define ft first #define sd second #define all(x) x.begin(),x.end() #define sz(x) ((int)x.size()) using namespace std; const int oo = int(1e9) + 1; vector<pii> vc; int n; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n = (int) s.size(); vc.PB(MP(1, -1)); vc.PB(MP(oo, +1)); for (int i = 0; i < n; i++) if (s[i] < t[i]){ vc.PB(MP(s[i], +1)); vc.PB(MP(t[i], -1)); } else { vc.PB(MP(s[i], -1)); vc.PB(MP(t[i], +1)); } sort(all(vc)); int sm = 0; for (int i = 0; i < sz(vc); ){ if (sm > 0) return 1; int j = i; while (j < sz(vc) && vc[i].ft == vc[j].ft){ sm += vc[j].sd; j++; } i = j; } 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...