# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272832 | rqi | Deda (COCI17_deda) | C++14 | 835 ms | 6904 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;
const int MOD = 1000000007;
const int SZ = 262144;
int seg[2*SZ];
void upd(int val, int pos){
for(int i = pos+SZ; i >= 1; i/=2){
seg[i] = min(seg[i], val);
}
}
int query(int Y, int pos, int ind = 1, int L = 0, int R = SZ-1){
if(R < pos) return -1;
if(L == R){
if(seg[ind] <= Y) return L;
return -1;
}
if(pos <= L && seg[ind] > Y){
return -1;
}
int M = (L+R)/2;
int val = query(Y, pos, 2*ind, L, M);
if(val != -1) return val;
return query(Y, pos, 2*ind+1, M+1, R);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |