Submission #1073926

#TimeUsernameProblemLanguageResultExecution timeMemory
1073926skittles1412Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
239 ms27588 KiB
#include "bits/extc++.h" using namespace std; template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t; ((cerr << " | " << u), ...); cerr << endl; } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__) #else #define dbg(...) #define cerr \ if (false) \ cerr #endif using ll = long long; #define endl "\n" #define long int64_t #define sz(x) int(std::size(x)) inline void init_io() { cin.tie(nullptr); cin.exceptions(ios::failbit); ios_base::sync_with_stdio(false); } template <typename T> ostream& operator<<(ostream& out, const vector<T>& arr) { out << "["; for (int i = 0; i < sz(arr); i++) { if (i) { out << ", "; } out << arr[i]; } return out << "]"; } template <typename T> struct PSA { int n; vector<T> psum; template <typename U> PSA(const vector<U>& arr) : n(sz(arr)), psum(n + 1) { for (int i = 0; i < n; i++) { psum[i + 1] = psum[i] + arr[i]; } } T query(int l, int r) const { return psum[r] - psum[l]; } }; template <typename T> bool on(T mask, int bit) { return (mask >> bit) & 1; } template <typename T> vector<T> iota(int n, T x) { vector<T> arr(n); iota(begin(arr), end(arr), x); return arr; } template <typename T> T reversed(T arr) { reverse(begin(arr), end(arr)); return arr; } template <typename A, typename B> ostream& operator<<(ostream& out, const pair<A, B>& p) { return out << "(" << p.first << ", " << p.second << ")"; } long solve(const vector<pair<int, int>>& arr) { dbg(arr); map<int, int, greater<>> cnt; for (auto& [a, b] : arr) { cnt[a]++; cnt[b]--; } int pref = 0; for (auto& [_t, v] : cnt) { pref += v; if (pref < 0) { return 1; } } return 0; } ll plan_roller_coaster(vector<int> s, vector<int> t) { vector<pair<int, int>> ans; for (int i = 0; i < sz(s); i++) { ans.emplace_back(s[i], t[i]); } return solve(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...