# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
949461 | hngwlog | Real Mountains (CCO23_day1problem2) | C++14 | 0 ms | 344 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>
using namespace std;
#define fi first
#define se second
#define _size(x) (int)x.size()
int n;
long long ans = 0;
vector<long long> h, newH;
void solve() {
set<pair<long long, long long>> st;
for (int i = 0; i < n; i++) {
if (h[i] == newH[i]) {
if (!i) st.insert({newH[i], newH[i]});
else if (newH[i] != newH[i - 1]) st.insert({newH[i], newH[i]});
continue;
}
vector<pair<long long, long long>> g;
auto it = st.upper_bound({h[i], h[i]});
if (it != st.begin()) {
it--;
if (it->se < h[i]) it++;
}
long long x = h[i];
while (true) {
g.push_back({it->fi, it->se});
if (it->fi > x) {
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |