#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) {
while(!pq.empty()){
pq.pop();
}
for(int i = l; i <= r; i++){
pq.push(lst[i]);
}
pq.push(0);
int num = 0;
int v = 0;
while(!pq.empty() && k >= (v - pq.top()) * num ){
k = k - (v - pq.top()) * num;
num++;
v = pq.top();
pq.pop();
}
if(pq.empty()){
for(int i = l; i <= r; i++){
lst[i] = 0;
}
return;
}
int unnuse = k % num;
int nam = k / num;
v = v - nam;
for(int i = l; i <= r; i++){
if(lst[i] >= v){
if(unnuse >= 1){
lst[i] = v - 1;
unnuse--;
}
else{
lst[i] = v;
}
}
}
/*for(int i = 0; i < lst.size(); i++){
printf("%d ",lst[i]);
}
printf("\n");*/
}
void magic(int i, int x) {
lst[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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
8 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
8 ms |
340 KB |
Output is correct |
3 |
Execution timed out |
2060 ms |
1716 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2080 ms |
5548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
8 ms |
340 KB |
Output is correct |
3 |
Execution timed out |
2060 ms |
1716 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
340 KB |
Output is correct |
2 |
Correct |
8 ms |
340 KB |
Output is correct |
3 |
Execution timed out |
2060 ms |
1716 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |