# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1165641 | phamducluong | Sum Zero (RMI20_sumzero) | C++20 | 217 ms | 23524 KiB |
#include <bits/stdc++.h>
using namespace std;
const int maxN = 4e5 + 5;
vector<pair<pair<int, int>, int> > query;
bool cmp_query(const pair<pair<int, int>, int> &a, const pair<pair<int, int>, int> &b)
{
return a.first.first > b.first.first;
}
map<long long, int> helper;
map<long long, int>::iterator m_iter;
int lq[maxN], val[maxN];
int last_l;
int calc(const int &l, const int &r)
{
//cout << "Start " << l << ' ' << r << '\n';
if(r < l)return 0;
if(val[r])last_l = lq[r];
val[r] = val[r] + calc(l, lq[r] - 1);
lq[r] = (val[r] ? last_l : l);
//cout << " Calc " << l << ' ' << r << ' ' << val[r] << '\n';
return val[r];
}
int re[maxN];
int res[maxN];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |