#include <bits/stdc++.h>
#include "elephants.h"
using namespace std;
int n;
int l;
int *x;
map<int,int>mp;
void init(int N, int L, int X[])
{
n = N;
l=L;
x=X;
for(int i = 0;i<n;i++){
mp[x[i]]++;
}
}
int update(int i, int y)
{
mp[x[i]]--;
if(mp[x[i]]==0){
mp.erase(x[i]);
}
x[i]=y;
mp[x[i]]++;
int ans = 1;
int las = (*mp.begin()).first;
for(pair<int,int>p:mp){
if(p.first-las>l){
las=p.first;
ans++;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
3697 ms |
2576 KB |
Output is correct |
8 |
Correct |
6000 ms |
2904 KB |
Output is correct |
9 |
Execution timed out |
9032 ms |
4956 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
3697 ms |
2576 KB |
Output is correct |
8 |
Correct |
6000 ms |
2904 KB |
Output is correct |
9 |
Execution timed out |
9032 ms |
4956 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
3697 ms |
2576 KB |
Output is correct |
8 |
Correct |
6000 ms |
2904 KB |
Output is correct |
9 |
Execution timed out |
9032 ms |
4956 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |