#include <bits/stdc++.h>
#include "elephants.h"
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
using namespace std;
using ii = pair<int,int>; using ll = long long; using ull = unsigned long long;
using vi = vector<int>;
void valid(int in){cout<<((in)?"YES\n":"NO\n");return;}
const int N = 1e5 + 5e4 + 7;
vi arr; multiset<int> st;
int ans = 0;int tam = 0;
void init(int n, int l, int X[]){tam = l;
fo(i,n){arr.pb(X[i]); st.insert(arr[i]);}
}
int update(int idx, int val){
st.erase(st.find(arr[idx]));ans=0;
st.insert(val);arr[idx] = val;
int last = -1e9 - 5;
for(int v : st){
if(last+tam <v){last = v; ans++;}
}return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6744 KB |
Output is correct |
3 |
Correct |
1 ms |
6584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6744 KB |
Output is correct |
3 |
Correct |
1 ms |
6584 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
3 ms |
6608 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6744 KB |
Output is correct |
3 |
Correct |
1 ms |
6584 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
3 ms |
6608 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4337 ms |
10340 KB |
Output is correct |
8 |
Correct |
6438 ms |
10656 KB |
Output is correct |
9 |
Execution timed out |
9058 ms |
12932 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6744 KB |
Output is correct |
3 |
Correct |
1 ms |
6584 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
3 ms |
6608 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4337 ms |
10340 KB |
Output is correct |
8 |
Correct |
6438 ms |
10656 KB |
Output is correct |
9 |
Execution timed out |
9058 ms |
12932 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6744 KB |
Output is correct |
3 |
Correct |
1 ms |
6584 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
3 ms |
6608 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4337 ms |
10340 KB |
Output is correct |
8 |
Correct |
6438 ms |
10656 KB |
Output is correct |
9 |
Execution timed out |
9058 ms |
12932 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |