# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
386158 | pit4h | Sparklers (JOI17_sparklers) | C++14 | 96 ms | 3436 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<bits/stdc++.h>
using namespace std;
using ll = long long;
bool solve(int n, int k, ll t, vector<ll> x) {
int l = k, r = k, L=k, R = k;
deque<int> monoL, monoR, MonoL, MonoR;
monoL.push_back(k), monoR.push_back(k);
MonoL.push_back(k), MonoR.push_back(k);
for(int i=0; i<n; ++i) {
while(l > 0 && (R-l+1) * t - (x[R] - x[l-1]) / 2 >= 0LL) {
l--;
while(monoL.size() && (k-l) * t + x[l] / 2 < (k-monoL.back()) * t + x[monoL.back()] / 2) {
monoL.pop_back();
}
monoL.push_back(l);
while(MonoL.size() && (k-l) * t + x[l] / 2 > (k-MonoL.back()) * t + x[MonoL.back()] / 2) {
MonoL.pop_back();
}
MonoL.push_back(l);
if((k-l) * t + x[l] / 2 > (k-L) * t + x[L] / 2) {
L = l;
}
}
while(r < n-1 && (r-L+1) * t - (x[r+1] - x[L]) / 2 >= 0LL) {
r++;
while(monoR.size() && (r-k) * t - x[r] / 2 < (monoR.back()-k) * t - x[monoR.back()] / 2) {
monoR.pop_back();
}
monoR.push_back(r);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |