#include "railroad.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t)
{
int n = s.size();
set<pii> S;
Loop (i,0,n)
S.insert({s[i], i});
int cnt = 0;
while (S.size()) {
int i = S.begin()->second;
int is = s[i], it = t[i];
S.erase(S.begin());
while (is < it) {
auto p = S.lower_bound(pii{it, INT_MIN});
if (p == S.end()) {
++cnt;
break;
}
int j = p->second;
S.erase(p);
it = t[j];
}
}
return cnt <= 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
131 ms |
16592 KB |
answer is not correct: 1 instead of 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
answer is not correct: 1 instead of 0 |
2 |
Halted |
0 ms |
0 KB |
- |