#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=50010;
int n, k;
int pos[MX];
map<int, int> cnt;
void init(int N, int L, int X[]){
n=N, k=L;
for(int i=0; i<n; i++) pos[i]=X[i], cnt[X[i]]++;
}
int update(int i, int y){
cnt[pos[i]]--;
if(cnt[pos[i]]==0) cnt.erase(cnt.find(pos[i]));
cnt[y]++; pos[i]=y;
vector<int> X;
for(auto &p:cnt){
int x=p.first;
X.push_back(x);
}
int l=X[0], ans=1;
for(int x:X){
if(l+k<x) l=x, ans++;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
3 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
708 KB |
Output is correct |
6 |
Correct |
3 ms |
708 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
3 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
708 KB |
Output is correct |
6 |
Correct |
3 ms |
708 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
2928 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
3 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
708 KB |
Output is correct |
6 |
Correct |
3 ms |
708 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
2928 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
3 ms |
528 KB |
Output is correct |
5 |
Correct |
3 ms |
708 KB |
Output is correct |
6 |
Correct |
3 ms |
708 KB |
Output is correct |
7 |
Execution timed out |
9022 ms |
2928 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |