# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169361 | Nodir_Bobiev | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 2199 ms | 94172 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>
# define FILE
using namespace std;
const int N = 1e6 + 100;
int n, m, w[N], l[N], ls[N], rs[N], ks[N], ans[N], mx[4*N];
vector < int > ids[N];
void update( int pos, int val, int tl = 1, int tr = n, int td = 1 ){
if( tl == tr )
mx[td] = max( mx[td], val );
else{
int tm = ( tl+tr ) >> 1;
if( pos <= tm )
update( pos, val, tl, tm, td+td );
else
update( pos, val, tm+1, tr, td+td+1 );
mx[td] = max( mx[td+td], mx[td+td+1] );
}
}
int get( int l, int r, int tl = 1, int tr = n, int td = 1 ){
if( l > r || l > tr || tl > r || tl > tr )
return 0;
if( l <= tl && tr <= r )
return mx[td];
else{
int tm = ( tl + tr )>> 1;
return max( get( l, r, tl, tm, td+td ), get( l,r, tm+1, tr, td+td+1 )) ;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |