#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using ld = long double;
#define all(x) (x).begin(),(x).end()
const int MN = 1e5 + 5, MOD = 1e9 + 7, BASE = 131;
vector<int> ret; vector<pii> na;
vector<int> countScans (vector<int> A, vector<int> X, vector<int> V) {
int n = A.size();
ret.resize(n);
int q = X.size();
na.resize(n); ret.resize(q);
for (int j = 0; j < q; j++) {
A[X[j]] = V[j];
for (int i = 0; i < n; i++) na[i] = {A[i],i};
stable_sort(all(na),[](const pii &a, const pii &b){return a.first < b.first;});
int ans = 0;
for (int i = 0; i < n; i++) ans = max(ans,na[i].second-i);
ret[j] = ans;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
2 |
Correct |
28 ms |
384 KB |
Output is correct |
3 |
Correct |
186 ms |
632 KB |
Output is correct |
4 |
Correct |
182 ms |
504 KB |
Output is correct |
5 |
Correct |
174 ms |
496 KB |
Output is correct |
6 |
Correct |
97 ms |
504 KB |
Output is correct |
7 |
Correct |
123 ms |
500 KB |
Output is correct |
8 |
Correct |
145 ms |
504 KB |
Output is correct |
9 |
Correct |
179 ms |
504 KB |
Output is correct |
10 |
Correct |
109 ms |
632 KB |
Output is correct |
11 |
Correct |
107 ms |
504 KB |
Output is correct |
12 |
Correct |
112 ms |
504 KB |
Output is correct |
13 |
Correct |
109 ms |
504 KB |
Output is correct |
14 |
Correct |
105 ms |
504 KB |
Output is correct |
15 |
Correct |
108 ms |
504 KB |
Output is correct |
16 |
Correct |
104 ms |
504 KB |
Output is correct |
17 |
Correct |
102 ms |
504 KB |
Output is correct |
18 |
Correct |
106 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
2 |
Correct |
28 ms |
384 KB |
Output is correct |
3 |
Correct |
186 ms |
632 KB |
Output is correct |
4 |
Correct |
182 ms |
504 KB |
Output is correct |
5 |
Correct |
174 ms |
496 KB |
Output is correct |
6 |
Correct |
97 ms |
504 KB |
Output is correct |
7 |
Correct |
123 ms |
500 KB |
Output is correct |
8 |
Correct |
145 ms |
504 KB |
Output is correct |
9 |
Correct |
179 ms |
504 KB |
Output is correct |
10 |
Correct |
109 ms |
632 KB |
Output is correct |
11 |
Correct |
107 ms |
504 KB |
Output is correct |
12 |
Correct |
112 ms |
504 KB |
Output is correct |
13 |
Correct |
109 ms |
504 KB |
Output is correct |
14 |
Correct |
105 ms |
504 KB |
Output is correct |
15 |
Correct |
108 ms |
504 KB |
Output is correct |
16 |
Correct |
104 ms |
504 KB |
Output is correct |
17 |
Correct |
102 ms |
504 KB |
Output is correct |
18 |
Correct |
106 ms |
508 KB |
Output is correct |
19 |
Correct |
3354 ms |
828 KB |
Output is correct |
20 |
Correct |
4418 ms |
896 KB |
Output is correct |
21 |
Correct |
2553 ms |
1016 KB |
Output is correct |
22 |
Correct |
4080 ms |
896 KB |
Output is correct |
23 |
Correct |
2463 ms |
1016 KB |
Output is correct |
24 |
Correct |
2467 ms |
888 KB |
Output is correct |
25 |
Correct |
2471 ms |
888 KB |
Output is correct |
26 |
Correct |
2466 ms |
872 KB |
Output is correct |
27 |
Correct |
2466 ms |
888 KB |
Output is correct |
28 |
Correct |
2462 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3511 ms |
1180 KB |
Output is correct |
2 |
Execution timed out |
9043 ms |
2176 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
384 KB |
Output is correct |
2 |
Correct |
28 ms |
384 KB |
Output is correct |
3 |
Correct |
186 ms |
632 KB |
Output is correct |
4 |
Correct |
182 ms |
504 KB |
Output is correct |
5 |
Correct |
174 ms |
496 KB |
Output is correct |
6 |
Correct |
97 ms |
504 KB |
Output is correct |
7 |
Correct |
123 ms |
500 KB |
Output is correct |
8 |
Correct |
145 ms |
504 KB |
Output is correct |
9 |
Correct |
179 ms |
504 KB |
Output is correct |
10 |
Correct |
109 ms |
632 KB |
Output is correct |
11 |
Correct |
107 ms |
504 KB |
Output is correct |
12 |
Correct |
112 ms |
504 KB |
Output is correct |
13 |
Correct |
109 ms |
504 KB |
Output is correct |
14 |
Correct |
105 ms |
504 KB |
Output is correct |
15 |
Correct |
108 ms |
504 KB |
Output is correct |
16 |
Correct |
104 ms |
504 KB |
Output is correct |
17 |
Correct |
102 ms |
504 KB |
Output is correct |
18 |
Correct |
106 ms |
508 KB |
Output is correct |
19 |
Correct |
3354 ms |
828 KB |
Output is correct |
20 |
Correct |
4418 ms |
896 KB |
Output is correct |
21 |
Correct |
2553 ms |
1016 KB |
Output is correct |
22 |
Correct |
4080 ms |
896 KB |
Output is correct |
23 |
Correct |
2463 ms |
1016 KB |
Output is correct |
24 |
Correct |
2467 ms |
888 KB |
Output is correct |
25 |
Correct |
2471 ms |
888 KB |
Output is correct |
26 |
Correct |
2466 ms |
872 KB |
Output is correct |
27 |
Correct |
2466 ms |
888 KB |
Output is correct |
28 |
Correct |
2462 ms |
888 KB |
Output is correct |
29 |
Correct |
3511 ms |
1180 KB |
Output is correct |
30 |
Execution timed out |
9043 ms |
2176 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |