#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std ;
using ll = long long ;
using pii = pair<ll , ll> ;
const int N = 1e6+5 ;
ll qs[N] , ans = 0;
deque<pii> dq ;
int besthub(int R, int L, int X[], long long B)
{
for(int i=0;i<R;i++){
qs[X[i]]++ ;
}
for(int i=1;i<=L;i++){
qs[i] += qs[i-1] ;
}
dq.push_back({0 , -1});
for(int i=0;i<=L;i++){
while(!dq.empty() && dq.front().second < i - B){
dq.pop_front();
}
ans = max(ans , qs[i] - dq.front().first) ;
cout << "i = " << i << " qs[i] = " << qs[i] << " dq.front() = {" << dq.front().first << " , " << dq.front().second << "}\n" ;
while(!dq.empty() && dq.back().first >= qs[i]){
dq.pop_back();
}
dq.push_back({qs[i] , i});
}
return ans ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
692 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
6408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |