#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};
sort(all(na));
int ans = 0;
for (int i = 0; i < n; i++) ans = max(ans,na[i].second-i);
ret[j] = ans;
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
40 ms |
384 KB |
Output is correct |
3 |
Correct |
228 ms |
384 KB |
Output is correct |
4 |
Correct |
227 ms |
384 KB |
Output is correct |
5 |
Correct |
220 ms |
504 KB |
Output is correct |
6 |
Correct |
149 ms |
384 KB |
Output is correct |
7 |
Correct |
185 ms |
384 KB |
Output is correct |
8 |
Correct |
205 ms |
504 KB |
Output is correct |
9 |
Correct |
219 ms |
504 KB |
Output is correct |
10 |
Correct |
134 ms |
384 KB |
Output is correct |
11 |
Correct |
133 ms |
384 KB |
Output is correct |
12 |
Correct |
135 ms |
384 KB |
Output is correct |
13 |
Correct |
134 ms |
384 KB |
Output is correct |
14 |
Correct |
131 ms |
384 KB |
Output is correct |
15 |
Correct |
132 ms |
384 KB |
Output is correct |
16 |
Correct |
124 ms |
504 KB |
Output is correct |
17 |
Correct |
124 ms |
504 KB |
Output is correct |
18 |
Correct |
118 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
40 ms |
384 KB |
Output is correct |
3 |
Correct |
228 ms |
384 KB |
Output is correct |
4 |
Correct |
227 ms |
384 KB |
Output is correct |
5 |
Correct |
220 ms |
504 KB |
Output is correct |
6 |
Correct |
149 ms |
384 KB |
Output is correct |
7 |
Correct |
185 ms |
384 KB |
Output is correct |
8 |
Correct |
205 ms |
504 KB |
Output is correct |
9 |
Correct |
219 ms |
504 KB |
Output is correct |
10 |
Correct |
134 ms |
384 KB |
Output is correct |
11 |
Correct |
133 ms |
384 KB |
Output is correct |
12 |
Correct |
135 ms |
384 KB |
Output is correct |
13 |
Correct |
134 ms |
384 KB |
Output is correct |
14 |
Correct |
131 ms |
384 KB |
Output is correct |
15 |
Correct |
132 ms |
384 KB |
Output is correct |
16 |
Correct |
124 ms |
504 KB |
Output is correct |
17 |
Correct |
124 ms |
504 KB |
Output is correct |
18 |
Correct |
118 ms |
384 KB |
Output is correct |
19 |
Correct |
3255 ms |
612 KB |
Output is correct |
20 |
Correct |
4315 ms |
760 KB |
Output is correct |
21 |
Correct |
3693 ms |
760 KB |
Output is correct |
22 |
Correct |
4167 ms |
760 KB |
Output is correct |
23 |
Correct |
2473 ms |
760 KB |
Output is correct |
24 |
Correct |
2501 ms |
760 KB |
Output is correct |
25 |
Correct |
2467 ms |
760 KB |
Output is correct |
26 |
Correct |
2437 ms |
640 KB |
Output is correct |
27 |
Correct |
2425 ms |
760 KB |
Output is correct |
28 |
Correct |
2433 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5577 ms |
948 KB |
Output is correct |
2 |
Execution timed out |
9041 ms |
1536 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
40 ms |
384 KB |
Output is correct |
3 |
Correct |
228 ms |
384 KB |
Output is correct |
4 |
Correct |
227 ms |
384 KB |
Output is correct |
5 |
Correct |
220 ms |
504 KB |
Output is correct |
6 |
Correct |
149 ms |
384 KB |
Output is correct |
7 |
Correct |
185 ms |
384 KB |
Output is correct |
8 |
Correct |
205 ms |
504 KB |
Output is correct |
9 |
Correct |
219 ms |
504 KB |
Output is correct |
10 |
Correct |
134 ms |
384 KB |
Output is correct |
11 |
Correct |
133 ms |
384 KB |
Output is correct |
12 |
Correct |
135 ms |
384 KB |
Output is correct |
13 |
Correct |
134 ms |
384 KB |
Output is correct |
14 |
Correct |
131 ms |
384 KB |
Output is correct |
15 |
Correct |
132 ms |
384 KB |
Output is correct |
16 |
Correct |
124 ms |
504 KB |
Output is correct |
17 |
Correct |
124 ms |
504 KB |
Output is correct |
18 |
Correct |
118 ms |
384 KB |
Output is correct |
19 |
Correct |
3255 ms |
612 KB |
Output is correct |
20 |
Correct |
4315 ms |
760 KB |
Output is correct |
21 |
Correct |
3693 ms |
760 KB |
Output is correct |
22 |
Correct |
4167 ms |
760 KB |
Output is correct |
23 |
Correct |
2473 ms |
760 KB |
Output is correct |
24 |
Correct |
2501 ms |
760 KB |
Output is correct |
25 |
Correct |
2467 ms |
760 KB |
Output is correct |
26 |
Correct |
2437 ms |
640 KB |
Output is correct |
27 |
Correct |
2425 ms |
760 KB |
Output is correct |
28 |
Correct |
2433 ms |
760 KB |
Output is correct |
29 |
Correct |
5577 ms |
948 KB |
Output is correct |
30 |
Execution timed out |
9041 ms |
1536 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |