#include "elephants.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define forr(i,A,B) for(int i=A;i<B;++i)
#define space ' '
#define endl '\n'
#define LL long long
using namespace std;
int n,l;
pair<int,int> a[100005];
void init(int N, int L, int X[]){
l=L;
n = N;
forr(i,0,N){
a[i].st=X[i];
a[i].nd=i;
}
}
int update(int i, int y){
int ans=1;
a[a[i].nd].st=y;
sort(a,a+n);
int lp=0,rp=0;
while(rp<n){
if(a[rp].st-a[lp].st<=l){
rp++;
}
else{
ans++;
lp=rp;
++rp;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
18424 KB |
Output is correct |
2 |
Correct |
0 ms |
18424 KB |
Output is correct |
3 |
Correct |
0 ms |
18424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
18424 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9000 ms |
18424 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
18424 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
109 ms |
18424 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |