#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
int n,l,up;
int elepos[150005];
multiset < int > line;
void init(int N, int L, int X[])
{
n = N;
l = L;
for(int i=0;i<N;i++){
elepos[i]=X[i];
line.insert(X[i]);
}
line.insert(INT_MAX);
}
int shoot(){
int camnum=0;
int covered=*line.begin();
multiset<int>::iterator it=line.begin();
while(*it!=INT_MAX){
//printf("%d DB camnum=%d covered=%d it=%d \n",up,camnum,covered,*it);
camnum++;
covered+=l;
it=line.upper_bound(covered);
covered=*it;
//printf("%d DB camnum=%d covered=%d it=%d \n",up,camnum,covered,*it);
}
return camnum;
}
int update(int i, int y)
{
line.erase(line.find(elepos[i]));
elepos[i]=y;
line.insert(elepos[i]);
up++;
return shoot();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
18232 KB |
Output is correct |
2 |
Correct |
0 ms |
18232 KB |
Output is correct |
3 |
Correct |
0 ms |
18232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
18232 KB |
Output is correct |
2 |
Correct |
0 ms |
18232 KB |
Output is correct |
3 |
Correct |
0 ms |
18232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
18892 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
19024 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
25228 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |