# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
403325 | penguinhacker | Deda (COCI17_deda) | C++14 | 119 ms | 7872 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.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=2e5;
int n, q, st[4*mxN];
void upd(int i, int x, int u=1, int l=0, int r=n-1) {
if (l>i||r<i)
return;
if (l==r) {
st[u]=x;
return;
}
int mid=(l+r)/2;
upd(i, x, 2*u, l, mid);
upd(i, x, 2*u+1, mid+1, r);
st[u]=min(st[2*u], st[2*u+1]);
}
int qry(int ql, int qr, int x, int u=1, int l=0, int r=n-1) {
if (l>qr||r<ql||st[u]>x)
return -1;
if (l==r)
return l+1;
int mid=(l+r)/2;
int al=qry(ql, qr, x, 2*u, l, mid);
if (al^-1)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |