#include <bits/stdc++.h>
#include <weirdtree.h>
using namespace std;
typedef long long ll;
int n;
ll arr[1001];
void initialise (int N, int q, int h[]) {
n = N;
if (n > 1000 || q > 1000) exit(0);
assert(n <= 1000 && q <= 1000);
for (int i = 1; i <= n; i++) {
arr[i] = h[i];
}
}
void cut (int l, int r, int k) {
vector <pair <ll, ll>> dd;
ll sum = 0;
for (int i = l; i <= r; i++) {
dd.push_back({arr[i], i});
sum += arr[i];
}
if (sum <= k) {
for (int i = l; i <= r; i++) arr[i] = 0;
return;
}
sort(dd.begin(), dd.end(), [] (pair <ll, ll> &a, pair <ll, ll> &b) {
return a.first == b.first ? a.second < b.second : a.first > b.first;
});
dd.push_back({0, (ll)1e9});
for (int i = 1; i < (int)dd.size(); i++) {
if (dd[i].first == dd[i - 1].first) continue;
ll t = (dd[i - 1].first - dd[i].first) * i;
if (t <= k) {
k -= t;
continue;
}
ll y = k / i;
for (int j = 0; j < i; j++) arr[dd[j].second] = y;
k -= y;
for (int j = 0; j < k; j++) arr[dd[j].second]--;
return;
}
}
void magic (int i, int x) {
arr[i] = x;
}
ll inspect (int l, int r) {
ll sum = 0;
for (int i = l; i <= r; i++) sum += arr[i];
return sum;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |