#include <bits/stdc++.h>
#include "elephants.h"
//~ #include "grader.cpp"
using namespace std;
int n, l;
vector <pair <int, int> > a;
void init(int N, int L, int X[]){
n = N;
l = L;
for(int i = 0 ; i < n ; i++){
a.push_back(make_pair(X[i], i));
}
}
int update(int i, int y){
for(int j = 0 ; j < n ; j++){
if(a[j].second == i){
a.erase(a.begin() + j);
break;
}
}
for(int j = 0 ; j < n ; j++){
if(j == n - 1 || a[j].first > y){
a.insert(a.begin() + j, make_pair(y, i));
break;
}
}
int cur = a[0].first;
int ans = 1;
for(auto &i : a){
if(cur + l < i.first){
cur = i.first;
ans++;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2638 ms |
1280 KB |
Output is correct |
8 |
Correct |
3863 ms |
1408 KB |
Output is correct |
9 |
Correct |
4924 ms |
3316 KB |
Output is correct |
10 |
Correct |
5628 ms |
3188 KB |
Output is correct |
11 |
Correct |
5828 ms |
3188 KB |
Output is correct |
12 |
Execution timed out |
9036 ms |
3188 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2638 ms |
1280 KB |
Output is correct |
8 |
Correct |
3863 ms |
1408 KB |
Output is correct |
9 |
Correct |
4924 ms |
3316 KB |
Output is correct |
10 |
Correct |
5628 ms |
3188 KB |
Output is correct |
11 |
Correct |
5828 ms |
3188 KB |
Output is correct |
12 |
Execution timed out |
9036 ms |
3188 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2638 ms |
1280 KB |
Output is correct |
8 |
Correct |
3863 ms |
1408 KB |
Output is correct |
9 |
Correct |
4924 ms |
3316 KB |
Output is correct |
10 |
Correct |
5628 ms |
3188 KB |
Output is correct |
11 |
Correct |
5828 ms |
3188 KB |
Output is correct |
12 |
Execution timed out |
9036 ms |
3188 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |