# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1043037 | Aldas25 | Safety (NOI18_safety) | C++14 | 56 ms | 7168 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;
typedef long long ll;
const int MAXN = 2e5 + 100;
int n;
ll h;
priority_queue<ll> pqLeft;
priority_queue<ll, vector<ll>, greater<ll>> pqRight;
ll ans = 0;
ll a[MAXN];
int main() {
cin >> n >> h;
for (int i = 0; i < n; i++) cin >> a[i];
pqLeft.push(a[0]); pqRight.push(a[0]);
for (int i = 1; i < n; i++) {
ll range = ((ll)i) * h; // mimic shifting left side by -h, and right side by h
// minimum area in graph is interval [pqLeft.top() - range; pqRight.top() + range]
ll minFrom = pqLeft.top() - range;
ll minTo = pqRight.top() + range;
if (a[i] < minFrom) {
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |