# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1130291 | gyg | Sličnost (COI23_slicnost) | C++20 | 826 ms | 42568 KiB |
#include <bits/stdc++.h>
using namespace std;
#define arr array
#define int long long
#define pii pair<int, int>
#define fir first
#define sec second
#define vec vector
const int N = 1e5 + 5;
int n, k, q;
arr<int, N> a, b;
struct Sg {
struct Nd { int mx, nm, lzy; };
Nd mrg(Nd x, Nd y) {
if (x.mx < y.mx) swap(x, y);
return {x.mx, x.nm + ((y.mx == x.mx) ? y.nm : 0), 0};
}
arr<Nd, 4 * N> sg;
void bld(int u = 1, int lw = 1, int hg = n - k + 1) {
if (lw == hg) { sg[u] = {0, 1, 0}; return; }
int md = (lw + hg) / 2;
bld(2 * u, lw, md), bld(2 * u + 1, md + 1, hg);
sg[u] = mrg(sg[2 * u], sg[2 * u + 1]);
}
void prp(int u) {
for (int v : {2 * u, 2 * u + 1})
sg[v].mx += sg[u].lzy, sg[v].lzy += sg[u].lzy;
sg[u].lzy = 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... |