# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976499 | LaviniaTornaghi | Quality Of Living (IOI10_quality) | C++14 | 7 ms | 4956 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;
#include "grader.h"
struct SegTree{
int tmp=1, target, MAXN;
vector<int> tree;
void init(int a, int b){
target = a; MAXN=b;
while(tmp<=MAXN) tmp*=2;
tree.resize(2*tmp);
}
void update(int p, int d){
tree[p+tmp]+=d;
p=(p+tmp)/2;
while(p){
tree[p]=tree[p*2]+tree[p*2+1];
p/=2;
}
}
int query(){ return query(1,0,tmp-1,0);}
int query(int i, int l, int r, int sl){
if(l==r) return i-tmp;
int m = (l+r)/2;
if(sl+tree[i*2]>target)return query(i*2,l,m,sl);
else return query(i*2+1,m+1,r,sl+tree[i*2]);
}
};
# | 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... |