제출 #266441

#제출 시각아이디문제언어결과실행 시간메모리
266441sealnot123Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
209 ms10736 KiB
#include "railroad.h" #include<bits/stdc++.h> #define x first #define y second #define pb push_back #define eb emplace_back #define all(a) (a).begin(),(a).end() #define SZ(a) (int)(a).size() #define FOR(i, a, b) for(int i=(a); i<=(b); ++i) #define ROF(i, a, b) for(int i=(a); i>=(b); --i) #define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin()) using namespace std; typedef pair<int,int> PII; typedef long long LL; typedef double DD; typedef long double LD; typedef pair<LL,LL> PLL; typedef pair<DD,DD> PDD; typedef vector<int> VI; typedef vector<LL> VL; int n; LL plan_roller_coaster(VI s, VI t) { int n = SZ(s); vector<int> comp; FOR(i,0,n-1) comp.pb(s[i]), comp.pb(t[i]); comp.pb(0); comp.pb(1e9+2); make_unique(comp); int m = SZ(comp); vector<int> dp(m); FOR(i,0,n-1){ s[i] = lower_bound(all(comp), s[i])-comp.begin(); t[i] = lower_bound(all(comp), t[i])-comp.begin(); if(s[i] == t[i]) continue; dp[s[i]]++; dp[t[i]]--; } dp[0]++; FOR(i, 0, m-1){ if(i > 0) dp[i] += dp[i-1]; if(dp[i] > 1) return 1; } 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...