제출 #282211

#제출 시각아이디문제언어결과실행 시간메모리
282211FashoRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
168 ms34672 KiB
#include <bits/stdc++.h> #define N 100005 #define ll long long int #define fo(i,x,y) for(int i=x;i<=y;i++) #define fs(ar,n) fo(i,1,n) cin>>ar[i] #define sp " " #define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false) #define pb push_back #define ppb pop_back #define fi first #define se second #define ii pair<int,int> #define lli pair<ll,ll> #define mod 1000000007 using namespace std; ll n,m,ar[N],sum,t; #include "railroad.h" lli p[N]; multiset<lli> st; multiset<lli>::iterator it; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); fo(i,1,n) { p[i]={s[i-1],t[i-1]}; st.insert(p[i]); } ll last=0; ll cnt=0; lli x={0,0}; lli tutmac={0,0}; fo(i,1,n) { it=st.lower_bound({last,0}); lli tut=*it; if(!st.count(*it) || tut.fi<last) { // cerr<<i<<sp<<last<<sp<<tut.fi<<sp<<tut.se<<endl; return 0; } x=*it; st.erase(it); if(cnt) { last=x.se; continue; } it=st.lower_bound({last,0}); tut=*it; if(!st.count(*it) || tut.fi<last) { cnt++; tutmac=x; continue; } last=x.se; // ll x=*it.se; } // cout<<endl; // cout<<tutmac.fi<<sp<<tutmac.se<<endl;; lli bos={0,0}; if(tutmac==bos) return 1; if(tutmac.fi>=last) return 1; return 0; } // int main() { // int n; // assert(1 == scanf("%d", &n)); // std::vector<int> s(n), t(n); // for (int i = 0; i < n; ++i) // assert(2 == scanf("%d%d", &s[i], &t[i])); // long long ans = plan_roller_coaster(s, t); // printf("%lld\n", ans); // 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...