#include "bubblesort2.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, Q;
pair<int, int> G[1 << 19];
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
N = A.size(); Q = X.size(); vector<int>ans;
for (int i = 0; i < Q; i++) {
A[X[i]] = V[i];
for (int j = 0; j < N; j++) G[j] = make_pair(A[j], j);
sort(G, G + N);
int maxn = 0;
for (int j = 0; j < N; j++) maxn = max(maxn, G[j].second - j);
ans.push_back(maxn);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
380 KB |
Output is correct |
2 |
Correct |
38 ms |
376 KB |
Output is correct |
3 |
Correct |
242 ms |
512 KB |
Output is correct |
4 |
Correct |
241 ms |
608 KB |
Output is correct |
5 |
Correct |
230 ms |
632 KB |
Output is correct |
6 |
Correct |
150 ms |
604 KB |
Output is correct |
7 |
Correct |
196 ms |
376 KB |
Output is correct |
8 |
Correct |
218 ms |
484 KB |
Output is correct |
9 |
Correct |
234 ms |
612 KB |
Output is correct |
10 |
Correct |
134 ms |
380 KB |
Output is correct |
11 |
Correct |
133 ms |
376 KB |
Output is correct |
12 |
Correct |
134 ms |
520 KB |
Output is correct |
13 |
Correct |
133 ms |
484 KB |
Output is correct |
14 |
Correct |
134 ms |
504 KB |
Output is correct |
15 |
Correct |
134 ms |
620 KB |
Output is correct |
16 |
Correct |
128 ms |
520 KB |
Output is correct |
17 |
Correct |
130 ms |
376 KB |
Output is correct |
18 |
Correct |
126 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
380 KB |
Output is correct |
2 |
Correct |
38 ms |
376 KB |
Output is correct |
3 |
Correct |
242 ms |
512 KB |
Output is correct |
4 |
Correct |
241 ms |
608 KB |
Output is correct |
5 |
Correct |
230 ms |
632 KB |
Output is correct |
6 |
Correct |
150 ms |
604 KB |
Output is correct |
7 |
Correct |
196 ms |
376 KB |
Output is correct |
8 |
Correct |
218 ms |
484 KB |
Output is correct |
9 |
Correct |
234 ms |
612 KB |
Output is correct |
10 |
Correct |
134 ms |
380 KB |
Output is correct |
11 |
Correct |
133 ms |
376 KB |
Output is correct |
12 |
Correct |
134 ms |
520 KB |
Output is correct |
13 |
Correct |
133 ms |
484 KB |
Output is correct |
14 |
Correct |
134 ms |
504 KB |
Output is correct |
15 |
Correct |
134 ms |
620 KB |
Output is correct |
16 |
Correct |
128 ms |
520 KB |
Output is correct |
17 |
Correct |
130 ms |
376 KB |
Output is correct |
18 |
Correct |
126 ms |
632 KB |
Output is correct |
19 |
Correct |
3467 ms |
1024 KB |
Output is correct |
20 |
Correct |
4580 ms |
1144 KB |
Output is correct |
21 |
Correct |
3900 ms |
1092 KB |
Output is correct |
22 |
Correct |
4389 ms |
992 KB |
Output is correct |
23 |
Correct |
2519 ms |
1140 KB |
Output is correct |
24 |
Correct |
2514 ms |
1072 KB |
Output is correct |
25 |
Correct |
2568 ms |
1068 KB |
Output is correct |
26 |
Correct |
2512 ms |
1184 KB |
Output is correct |
27 |
Correct |
2523 ms |
1016 KB |
Output is correct |
28 |
Correct |
2515 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5791 ms |
1052 KB |
Output is correct |
2 |
Execution timed out |
9086 ms |
1848 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
380 KB |
Output is correct |
2 |
Correct |
38 ms |
376 KB |
Output is correct |
3 |
Correct |
242 ms |
512 KB |
Output is correct |
4 |
Correct |
241 ms |
608 KB |
Output is correct |
5 |
Correct |
230 ms |
632 KB |
Output is correct |
6 |
Correct |
150 ms |
604 KB |
Output is correct |
7 |
Correct |
196 ms |
376 KB |
Output is correct |
8 |
Correct |
218 ms |
484 KB |
Output is correct |
9 |
Correct |
234 ms |
612 KB |
Output is correct |
10 |
Correct |
134 ms |
380 KB |
Output is correct |
11 |
Correct |
133 ms |
376 KB |
Output is correct |
12 |
Correct |
134 ms |
520 KB |
Output is correct |
13 |
Correct |
133 ms |
484 KB |
Output is correct |
14 |
Correct |
134 ms |
504 KB |
Output is correct |
15 |
Correct |
134 ms |
620 KB |
Output is correct |
16 |
Correct |
128 ms |
520 KB |
Output is correct |
17 |
Correct |
130 ms |
376 KB |
Output is correct |
18 |
Correct |
126 ms |
632 KB |
Output is correct |
19 |
Correct |
3467 ms |
1024 KB |
Output is correct |
20 |
Correct |
4580 ms |
1144 KB |
Output is correct |
21 |
Correct |
3900 ms |
1092 KB |
Output is correct |
22 |
Correct |
4389 ms |
992 KB |
Output is correct |
23 |
Correct |
2519 ms |
1140 KB |
Output is correct |
24 |
Correct |
2514 ms |
1072 KB |
Output is correct |
25 |
Correct |
2568 ms |
1068 KB |
Output is correct |
26 |
Correct |
2512 ms |
1184 KB |
Output is correct |
27 |
Correct |
2523 ms |
1016 KB |
Output is correct |
28 |
Correct |
2515 ms |
1144 KB |
Output is correct |
29 |
Correct |
5791 ms |
1052 KB |
Output is correct |
30 |
Execution timed out |
9086 ms |
1848 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |