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"elephants.h"
#include<bits/stdc++.h>
using namespace std;
int n,pos[150001],l;
multiset<int>myset;
void init(int N,int L,int X[]){
n=N,l=L;
for (int i=0;i<n;i++){
pos[i]=X[i];
myset.insert(X[i]);
}
}
int update(int i,int y){
myset.erase(myset.find(pos[i]));
myset.insert(y);
int b=-1,ans=0;
for(auto it:myset){
if(it<=b)continue;
b=it+l,ans++;
}
pos[i]=y;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |