#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << ": " << x << " "
#define nl cout << "\n"
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int *a, N, L;
vector<int> st;
void init(int n, int l, int X[]){
a = X, N = n, L = l;
rep(i, 0, n) st.pb(X[i]);
}
int update(int i, int y){
st.erase(find(all(st), a[i]));
a[i] = y;
st.insert(upper_bound(all(st), a[i]), a[i]);
int ans = 1, p = st[0];
rep(i, 1, N){
if(p + L < st[i]){
p = st[i], ans++;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
2131 ms |
1068 KB |
Output is correct |
8 |
Correct |
3166 ms |
1240 KB |
Output is correct |
9 |
Correct |
3158 ms |
1636 KB |
Output is correct |
10 |
Correct |
2746 ms |
1604 KB |
Output is correct |
11 |
Correct |
2883 ms |
1604 KB |
Output is correct |
12 |
Correct |
7605 ms |
1604 KB |
Output is correct |
13 |
Correct |
3170 ms |
1612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
2131 ms |
1068 KB |
Output is correct |
8 |
Correct |
3166 ms |
1240 KB |
Output is correct |
9 |
Correct |
3158 ms |
1636 KB |
Output is correct |
10 |
Correct |
2746 ms |
1604 KB |
Output is correct |
11 |
Correct |
2883 ms |
1604 KB |
Output is correct |
12 |
Correct |
7605 ms |
1604 KB |
Output is correct |
13 |
Correct |
3170 ms |
1612 KB |
Output is correct |
14 |
Correct |
1818 ms |
1476 KB |
Output is correct |
15 |
Correct |
6089 ms |
1588 KB |
Output is correct |
16 |
Execution timed out |
9012 ms |
1740 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
2131 ms |
1068 KB |
Output is correct |
8 |
Correct |
3166 ms |
1240 KB |
Output is correct |
9 |
Correct |
3158 ms |
1636 KB |
Output is correct |
10 |
Correct |
2746 ms |
1604 KB |
Output is correct |
11 |
Correct |
2883 ms |
1604 KB |
Output is correct |
12 |
Correct |
7605 ms |
1604 KB |
Output is correct |
13 |
Correct |
3170 ms |
1612 KB |
Output is correct |
14 |
Correct |
1818 ms |
1476 KB |
Output is correct |
15 |
Correct |
6089 ms |
1588 KB |
Output is correct |
16 |
Execution timed out |
9012 ms |
1740 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |