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;
typedef long long ll;
const int MAX = 2e6 + 15;
int n, l, x[MAX];
multiset<int> s;
void init(int n_, int l_, int x_[]){
n = n_, l = l_;
for(int i = 0; i < n; i++)
x[i] = x_[i], s.insert(x[i]);
}
int update(int i, int y){
s.erase(s.find(x[i]));
s.insert(y);
x[i] = y;
int ans = 0, r = -1;
for(auto x : s)
if(x > r) ans++, r = x + l;
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... |