#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
typedef int INT;
#define FOR(i,l,r) for(int i = (l); i < (r); i++)
#define snd second
#define fst first
#define V vector
#define pb push_back
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int N, L;
int *X;
set<int> s;
void init(int n, int l, int x[]) {
X = x;
N = n;
L = l;
FOR(i, 0, N) s.insert(X[i]);
}
int update(int i, int y){
s.erase(X[i]);
X[i] = y;
s.insert(y);
int last = *s.begin();
int cnt = 1;
for(int k : s){
if(last+L < k) {
last = k;
cnt++;
}
}
return cnt;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
584 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
584 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
704 KB |
Output is correct |
5 |
Correct |
2 ms |
704 KB |
Output is correct |
6 |
Correct |
2 ms |
704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
584 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
704 KB |
Output is correct |
5 |
Correct |
2 ms |
704 KB |
Output is correct |
6 |
Correct |
2 ms |
704 KB |
Output is correct |
7 |
Correct |
8485 ms |
2988 KB |
Output is correct |
8 |
Execution timed out |
9061 ms |
4312 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
584 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
704 KB |
Output is correct |
5 |
Correct |
2 ms |
704 KB |
Output is correct |
6 |
Correct |
2 ms |
704 KB |
Output is correct |
7 |
Correct |
8485 ms |
2988 KB |
Output is correct |
8 |
Execution timed out |
9061 ms |
4312 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
584 KB |
Output is correct |
3 |
Correct |
2 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
704 KB |
Output is correct |
5 |
Correct |
2 ms |
704 KB |
Output is correct |
6 |
Correct |
2 ms |
704 KB |
Output is correct |
7 |
Correct |
8485 ms |
2988 KB |
Output is correct |
8 |
Execution timed out |
9061 ms |
4312 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |