Submission #871073

#TimeUsernameProblemLanguageResultExecution timeMemory
871073MinaRagy06Weirdtree (RMI21_weirdtree)C++17
0 / 100
2062 ms4108 KiB
#include <bits/stdc++.h> #include "weirdtree.h" #ifdef MINA #include "grader.cpp" #endif using namespace std; #define ll long long const int N = 3e5 + 5; int n; ll a[N]; void initialise(int _n, int _q, int h[]) { n = _n; for (int i = 1; i <= n; i++) { a[i] = h[i]; } } void cut(int l, int r, int k) { while (k--) { pair<ll, int> mx = {-1e18, -1e9}; for (int i = l; i <= r; i++) { mx = max(mx, {a[i], -l}); } int idx = mx.second; a[idx] = max(a[idx] - 1, 0ll); } } void magic(int i, int x) { a[i] = x; } ll inspect(int l, int r) { ll s = 0; for (int i = l; i <= r; i++) { s += a[i]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...