# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
561982 | maximath_1 | Land of the Rainbow Gold (APIO17_rainbow) | C++11 | 891 ms | 98768 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 "rainbow.h"
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
const int MX = 2e5 + 5;
struct segmentTree{
vector<int> st[MX * 2 + 5];
void upd(int ps, int val){
st[ps + MX].push_back(val);
}
void proc(){
for(int i = MX; i < 2 * MX; i ++){
sort(st[i].begin(), st[i].end());
st[i].erase(unique(st[i].begin(), st[i].end()), st[i].end());
}
for(int i = MX - 1; i > 0; i --){
st[i] = vector<int>(st[i * 2].size() + st[i * 2 + 1].size());
merge(st[i * 2].begin(), st[i * 2].end(), st[i * 2 + 1].begin(), st[i * 2 + 1].end(), st[i].begin());
}
}
int que(int lf, int rg, int x, int y){
int ans = 0;
for(lf += MX, rg += MX + 1; lf < rg; lf /= 2, rg /= 2){
if(lf % 2)
ans += upper_bound(st[lf].begin(), st[lf].end(), y) - lower_bound(st[lf].begin(), st[lf].end(), x), lf ++;
if(rg % 2)
rg --, ans += upper_bound(st[rg].begin(), st[rg].end(), y) - lower_bound(st[rg].begin(), st[rg].end(), x);
# | 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... |