# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745069 | rt144 | Street Lamps (APIO19_street_lamps) | C++17 | 5079 ms | 35364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
// #include <icecream.hpp>
using namespace std;
const int maxn = 3e5+5, inf = 2*maxn;
struct bst : set<pair<int, int>> {
int prev = 0;
int get_times(int x) {
if (!empty() && rbegin()->second>=x) {
return prev + x-rbegin()->first+1;
} else return prev;
}
void toggle(int x) {
if (empty() || rbegin()->second<x) {
insert({x+1, inf});
} else {
int start = rbegin()->first;
erase(--end()); insert({start, x});
prev += x-start+1;
}
}
};
// using bst = set<pair<int, int>>;
int n, q;
bst st[maxn];
bst merge(bst &a, bst &b) {
if (a.empty()) return a;
if (b.empty()) return b;
auto ai = a.begin(), bi = b.begin();
bst nxt{};
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |