Submission #1046799

#TimeUsernameProblemLanguageResultExecution timeMemory
1046799Edu175Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
59 ms20428 KiB
#include "railroad.h" #include <bits/stdc++.h> #define pb push_back #define fst first #define snd second #define fore(i,a,b) for(ll i=a,ioi=b;i<ioi;i++) #define SZ(x) ((int)x.size()) #define ALL(x) x.begin(),x.end() #define mset(a,v) memset((a),(v),sizeof(a)) #define imp(v) {for(auto dkfjhg:v)cout<<dkfjhg<<" ";cout<<"\n";} using namespace std; typedef long long ll; typedef pair<ll,ll> ii; const ll MAXN=2e5+5,INF=1e15; long long plan_roller_coaster(std::vector<int> A, std::vector<int> B) { vector<ll>a,b; for(auto i:A)a.pb(i); for(auto i:B)b.pb(i); a.pb(INF); b.pb(1); ll n=SZ(a); vector<ii>ev; fore(i,0,n){ ev.pb({a[i],1}); ev.pb({b[i],-1}); } sort(ALL(ev)); ll s=0,flag=1; fore(i,0,SZ(ev)){ s+=ev[i].snd; if(i==SZ(ev)-1||ev[i].fst!=ev[i+1].fst)flag&=s<=0; } return !flag; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...