#include "weirdtree.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int NN=3e5+5;
ll n,a[NN];
void initialise(int N, int Q, int h[]) {
n=N;
for (int i=1;i<=n;i++) a[i]=h[i];
return;
}
void cut(int l, int r, int k) {
while (k>0){
ll mx1=0,mx2=0,f=0,d=0;
vector<int> v;
for (int i=l;i<=r;i++) mx1=max(mx1,a[i]);
if (mx1==0) break;
for (int i=l;i<=r;i++){
if (a[i]==mx1){
v.pb(i);
f++;
}
else mx2=max(mx2,a[i]);
}
//cout<<mx1<<' '<<mx2<<endl;
d=(mx1-mx2);
if (k>=d*f){
for (auto u:v) a[u]=mx2;
k-=d*f;
continue;
}
for (auto u:v) a[u]-=k/f;
for (int i=0;i<k%f;i++) a[v[i]]--;
break;
}return;
}
void magic(int i, int x) {
a[i]=x;
return;
}
long long int inspect(int l, int r) {
int sum=0;
for (int i=l;i<=r;i++) sum+=a[i];
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2040 ms |
5488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |