// #include "grader.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;
const int nax = 1e5;
int n,l;
vector<int> a;
int p[nax];
void init(int N, int L, int X[]){
n = N;
l=L;
for(int i=0;i<n;i++){
a.push_back(X[i]);
p[i] = X[i];
}
}
int update(int x, int y){
vector<int> tmp;
int w = y;
for(int i=0;i<n;i++){
if(a[i] == p[x])
continue;
if(a[i] >= y){
tmp.push_back(y);
y = 2e9;
}
tmp.push_back(a[i]);
}
p[x] = w;
if(tmp.size() != a.size())
tmp.push_back(y);
a = tmp;
int ans = 0;
int to = -1;
for(int it : a){
if(it > to){
to = it+l;
ans++;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
3646 ms |
2176 KB |
Output is correct |
8 |
Correct |
7693 ms |
2748 KB |
Output is correct |
9 |
Execution timed out |
9070 ms |
4000 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
3646 ms |
2176 KB |
Output is correct |
8 |
Correct |
7693 ms |
2748 KB |
Output is correct |
9 |
Execution timed out |
9070 ms |
4000 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
3646 ms |
2176 KB |
Output is correct |
8 |
Correct |
7693 ms |
2748 KB |
Output is correct |
9 |
Execution timed out |
9070 ms |
4000 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |