이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |