# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
744049 | salmon | Weirdtree (RMI21_weirdtree) | C++14 | 0 ms | 0 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 "weirdtree.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> lst;
priority_queue<int> pq;
void initialise(int N, int Q, int h[]) {
lst.push_back(0);
for(int i = 1; i <= N; i++){
lst.push_back(h[i]);
}
}
void cut(int l, int r, int k) {
for(int i = l; i <= r; i++){
pq.push(make_pair(v[i],-i));
}
while(k != 0)
if(pq.top() == 0){
return;
}
}
v[-pq.top().second]--;
pq.clear();
}
void magic(int i, int x) {
v[i] = x;
}
long long int inspect(int l, int r) {
long long int V = 0;
for(int i = l ; i <= r; i++){
V = V + lst[i];
}
return V;
}