/*
_ _ _ __ __ _____
/\ | | /\ | | | | | \/ |/ ____|
/ \ | |__ ___ / \ | |__ __| | ___ | \ / | |
/ /\ \ | '_ \ / _ \ / /\ \ | '_ \ / _` |/ _ \| |\/| | |
/ ____ \| |_) | (_) / ____ \| |_) | (_| | (_) | | | | |____
/_/ \_\_.__/ \___/_/ \_\_.__/ \__,_|\___/|_| |_|\_____|
*/
// build command:
// g++ -std=gnu++17 -O3 -DDEBUG -g -fsanitize=signed-integer-overflow -fsanitize=bounds-strict -fsanitize=address -fsanitize=integer-divide-by-zero -fsanitize=float-divide-by-zero -fsanitize=pointer-overflow -fsanitize=shift-exponent -fsplit-stack -Wshadow -Wall -fconcepts -Wno-unused-result
// REMEMBER:
// BS, Offline, Persistent SegTree, SQRT, Treap, MaxFlow, FFT, Matrices
#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
// DEBUG STUFF
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#ifdef DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
// RANDOM NUMBER GENERATOR
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers.
int getrand(int l,int r) {
return uniform_int_distribution<int>(l, r)(RNG);
}
const ld eps = 1e-9;
const int mod = 1e9 + 7;
const int oo = 1e9 + 7;
const ll lloo = 1e18 + 7;
const int N = 1e6 + 7;
long long plan_roller_coaster(vector<int> s,vector<int> t) {
int n = sz(t);
vector<pii> sweep;
for(int i = 0 ; i < n ; i++) {
sweep.pb({s[i],+1});
sweep.pb({t[i],-1});
}
sort(all(sweep));
int cnt = -1;
int last = 0;
for(auto p:sweep) {
//cout << p.F << ' ' << p.S << ' ' << cnt << '\n';
if (cnt > 0 && last != p.F) return 1;
cnt += p.S;
last = p.F;
}
return cnt > 0;
}
//int main() {
//int n;
//cin >> n;
//vector<int> s(n),t(n);
//for(int i = 0 ; i < n ; i++) cin >> s[i] >> t[i];
//cout << plan_roller_coaster(s,t) << '\n';
//}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
7736 KB |
n = 199999 |
2 |
Correct |
69 ms |
11444 KB |
n = 199991 |
3 |
Correct |
72 ms |
11444 KB |
n = 199993 |
4 |
Correct |
53 ms |
9532 KB |
n = 152076 |
5 |
Correct |
33 ms |
5748 KB |
n = 93249 |
6 |
Correct |
62 ms |
10408 KB |
n = 199910 |
7 |
Correct |
65 ms |
10812 KB |
n = 199999 |
8 |
Correct |
63 ms |
10416 KB |
n = 199997 |
9 |
Correct |
59 ms |
10324 KB |
n = 171294 |
10 |
Correct |
50 ms |
9440 KB |
n = 140872 |
11 |
Incorrect |
62 ms |
10416 KB |
answer is not correct: 0 instead of 1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
n = 2 |
2 |
Correct |
1 ms |
212 KB |
n = 2 |
3 |
Correct |
1 ms |
212 KB |
n = 2 |
4 |
Correct |
0 ms |
212 KB |
n = 2 |
5 |
Correct |
0 ms |
212 KB |
n = 2 |
6 |
Incorrect |
0 ms |
212 KB |
answer is not correct: 1 instead of 523688153 |
7 |
Halted |
0 ms |
0 KB |
- |