#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
const int TAILLEMAXI=102;
int pos[TAILLEMAXI];
int nbelephants,camera,rep,avant;
vector<int> ec;
void init(int N, int L, int depart[]){
nbelephants=N;
for (int i=0;i<nbelephants;i++){
pos[i]=depart[i];
}
camera=L;
}
int update(int indice, int nouv){
pos[indice]=nouv;
ec.clear();
for (int i=0;i<nbelephants;i++){
ec.push_back(pos[i]);
}
sort(ec.begin(),ec.end());
rep=0;
avant=-(1000*1000*1000+2);
for (int i=0;i<nbelephants;i++){
if (avant<ec[i]-camera){
avant=ec[i];
rep++;
}
}
return rep;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
0 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
0 ms |
6492 KB |
Output is correct |
7 |
Incorrect |
10 ms |
9820 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
0 ms |
6492 KB |
Output is correct |
7 |
Incorrect |
10 ms |
9820 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
0 ms |
6492 KB |
Output is correct |
7 |
Incorrect |
10 ms |
9820 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |