# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1090869 | vjudge1 | Safety (NOI18_safety) | C++17 | 156 ms | 21064 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 <cassert>
#include <iostream>
#include <set>
#include <vector>
int main() {
std::cin.tie(NULL)->sync_with_stdio(false);
int n, h;
std::cin >> n >> h;
std::vector<int> m(2, 0);
std::vector<long long> x_shift(2, 0);
std::vector<long long> c(2, 0);
x_shift[0] = h, x_shift[1] = -h;
std::multiset<long long> m_changes[2]; // xpos for each m changes +1
for (int i = 0; i < n; i++) {
long long x;
std::cin >> x;
// shift by h
x_shift[0] -= h;
x_shift[1] += h;
c[0] += 1LL * m[0] * h;
c[1] -= 1LL * m[1] * h;
// append to line
m[0]--;
m[1]++;
m_changes[0].insert(x - x_shift[0]);
# | 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... |