This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "https://judge.yosupo.jp/problem/static_range_inversions_query"
#include "../../others/coordinate_compression.hpp"
#include "../../data_structure/binary_indexed_tree.hpp"
#include "../../others/mo.hpp"
#include "../../template/template.hpp"
using namespace std;
int main() {
int n, q;
kin >> n >> q;
vc<int> a(n);
kin >> a;
vc<pair<int, int>> queries(q);
kin >> queries;
kk2::CC cc(a);
vc<int> b = cc(a);
kk2::BinaryIndexedTree<int> bit(cc.size());
kk2::Mo mo(n, queries);
vc<i64> res(q);
i64 now = 0;
auto insert_left = [&](int i) {
bit.add(b[i], 1);
now += bit.sum(0, b[i]);
};
auto insert_right = [&](int i) {
bit.add(b[i], 1);
now += bit.sum(b[i] + 1, cc.size());
};
auto erase_left = [&](int i) {
now -= bit.sum(0, b[i]);
bit.add(b[i], -1);
};
auto erase_right = [&](int i) {
now -= bit.sum(b[i] + 1, cc.size());
bit.add(b[i], -1);
};
auto f = [&](int i) { res[i] = now; };
mo.calculate(insert_left, insert_right, erase_left, erase_right, f);
for (auto x : res) kout << x << "\n";
return 0;
}
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
bundler.update(path)
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: type_traits/integral.hpp: line 4: #pragma once found in a non-first line