#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN = (int)1.5e5+10;
const int B = 240;
set<int> S;
int n, L, ok;
int a[mxN], b[mxN], p[mxN];
vector<pair<int,int>> block[mxN/B];
void ins(int x){
b[x]++; if(b[x]!=1) return; a[x]=1;
if(ok) { S.insert(x); return; }
}
void del(int x){
b[x]--; if(!b[x]) return; a[x]=0;
if(ok) { S.erase(x); return;}
}
void init(int N, int l, int X[])
{
n = N; L = l;
if(L > N/B or 1) ok=1;
for(int i = 0; i < n; i++)
p[i]=X[i], ins(p[i]);
}
int update(int i, int y)
{
del(p[i]); p[i]=y; ins(y);
int ans = 0;
if(ok){
int cur = 0;
auto itr = S.lower_bound(cur);
while(itr!=S.end()) itr = S.upper_bound(*itr+L), ans++;
return ans;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |