# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1127678 | khanhphucscratch | Exam (eJOI20_exam) | C++20 | 148 ms | 15152 KiB |
//Subtask 2
#include<bits/stdc++.h>
using namespace std;
int st[400005];
int a[100005], b[100005], dp[100005], sparse[100005][20];
void update(int node, int l, int r, int p, int v)
{
if(l > p || r < p) return;
if(l == p && r == p) st[node] = v;
else{
int mid = (l+r)/2;
update(node*2, l, mid, p, v);
update(node*2+1, mid+1, r, p, v);
st[node] = max(st[node*2], st[node*2+1]);
}
}
int query(int node, int l, int r, int tl, int tr)
{
if(l > tr || r < tl) return -1e9;
if(l >= tl && r <= tr) return st[node];
else return max(query(node*2, l, (l+r)/2, tl, tr), query(node*2+1, (l+r)/2+1, r, tl, tr));
}
int mquery(int l, int r)
{
if(l > r) swap(l, r);
int x = __lg(r-l+1);
return max(sparse[l][x], sparse[r-(1<<x)+1][x]);
}
void preprocess(int n)
{
# | 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... |