# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
652156 | vovik | Segments (IZhO18_segments) | C++17 | 5058 ms | 22528 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.
//Bitch, я поймал свой balance
//Теперь нихуя не надо делать
#include <bits/stdc++.h>
#define vc vector
using namespace std;
typedef long long ll;
#define X first
#define Y second
const int K = 2000, N = 2e5 + 5;
vc<int> ls[N / K + 1];
vc<int> rs[N / K + 1];
vc<int> self_l[N];
vc<int> self_r[N];
vc<int> e;
int get(int L, int R, int k) {
int dl = R - k + 2, dr = L + k - 2;
//for l [dl; inf]
//for r [-inf; dr]
int ans = 0;
k = lower_bound(e.begin(), e.end(), k) - e.begin();
for (int i = k / K + 1; i <= N / K; ++i) ans += ls[i].size();
for (int i = k / K + 1; i <= N / K; ++i) ans -= ls[i].end() - lower_bound(ls[i].begin(), ls[i].end(), dl);
for (int i = k / K + 1; i <= N / K; ++i) ans -= upper_bound(rs[i].begin(), rs[i].end(), dr) - rs[i].begin();
for (int len = k; len < (k / K + 1) * K; ++len) ans += self_l[len].size();
# | 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... |