Submission #386158

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3861582021-04-05 20:32:58pit4hSparklers (JOI17_sparklers)C++14
100 / 100
96 ms3436 KiB
#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);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...