#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
6348 ms |
2592 KB |
Output is correct |
8 |
Correct |
8866 ms |
3064 KB |
Output is correct |
9 |
Execution timed out |
9051 ms |
5240 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
6348 ms |
2592 KB |
Output is correct |
8 |
Correct |
8866 ms |
3064 KB |
Output is correct |
9 |
Execution timed out |
9051 ms |
5240 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
6348 ms |
2592 KB |
Output is correct |
8 |
Correct |
8866 ms |
3064 KB |
Output is correct |
9 |
Execution timed out |
9051 ms |
5240 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |