# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
633225 | Gromp15 | Abracadabra (CEOI22_abracadabra) | C++17 | 530 ms | 40216 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define ar array
using namespace std;
struct fenwick {
int n, lg; vector<int> bit;
fenwick(int a) : n(a), lg(__lg(n)), bit(a+1) {}
int pref(int pos) {
pos++;
int ret = 0;
if (pos > n) pos = n;
while (pos) {
ret += bit[pos], pos -= pos&-pos;
}
return ret;
}
int point(int pos) {
return pref(pos) - pref(pos-1);
}
void update(int pos, int x) {
pos++;
while (pos <= n) {
bit[pos] += x, pos += pos&-pos;
}
}
int last_smaller(int x) {
int pos = 0;
for (int i = lg; i >= 0; i--) {
if (pos + (1 << i) <= n && x > bit[pos+(1<<i)]) {
x -= bit[pos+(1<<i)];
# | 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... |