# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769634 | gg123_pe | Sequence (APIO23_sequence) | C++17 | 541 ms | 45516 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 "sequence.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
#define f(i,a,b) for(int i = a; i < b; i++)
#define fa(i,a,b) for(int i = a; i >= b; i--)
const int N = 5e5 + 5;
const int inf = 2e9;
int n;
int bit[N], c[N];
vector <pair<int,int>> pos[N];
void upd(int x, int val){
for(; x < N; x = (x|(x+1))) bit[x] += val;
}
int sum(int x){
int res = 0;
for(; x >= 0; x = (x&(x+1)) - 1) res += bit[x];
return res;
}
int get(int x){
int l = 1, r = n;
while(l < r){
int m = (l+r)>>1;
if(sum(m) >= x) r = m;
else l = m+1;
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |