#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> countScans(vector<int> a, vector<int> pos, vector<int> value){
int n = (int) a.size();
int q = (int) pos.size();
assert(q == (int) value.size());
vector<int> sol;
for (int it = 0; it < q; it++) {
a[pos[it]] = value[it];
int MX = 0;
for (int i = 0; i < n; i++) {
int bigger = 0;
for (int j = 0; j < i; j++) {
if (a[j] > a[i]) {
bigger++;
}
}
MX = max(MX, bigger);
}
sol.push_back(MX);
}
return sol;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
208 KB |
Output is correct |
2 |
Correct |
201 ms |
312 KB |
Output is correct |
3 |
Correct |
2787 ms |
384 KB |
Output is correct |
4 |
Correct |
2789 ms |
504 KB |
Output is correct |
5 |
Correct |
2782 ms |
496 KB |
Output is correct |
6 |
Correct |
2805 ms |
500 KB |
Output is correct |
7 |
Correct |
2944 ms |
388 KB |
Output is correct |
8 |
Correct |
3226 ms |
380 KB |
Output is correct |
9 |
Correct |
3211 ms |
500 KB |
Output is correct |
10 |
Correct |
3156 ms |
360 KB |
Output is correct |
11 |
Correct |
3098 ms |
372 KB |
Output is correct |
12 |
Correct |
2996 ms |
372 KB |
Output is correct |
13 |
Correct |
3194 ms |
376 KB |
Output is correct |
14 |
Correct |
3113 ms |
504 KB |
Output is correct |
15 |
Correct |
3326 ms |
464 KB |
Output is correct |
16 |
Correct |
3238 ms |
376 KB |
Output is correct |
17 |
Correct |
3123 ms |
380 KB |
Output is correct |
18 |
Correct |
3081 ms |
372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
208 KB |
Output is correct |
2 |
Correct |
201 ms |
312 KB |
Output is correct |
3 |
Correct |
2787 ms |
384 KB |
Output is correct |
4 |
Correct |
2789 ms |
504 KB |
Output is correct |
5 |
Correct |
2782 ms |
496 KB |
Output is correct |
6 |
Correct |
2805 ms |
500 KB |
Output is correct |
7 |
Correct |
2944 ms |
388 KB |
Output is correct |
8 |
Correct |
3226 ms |
380 KB |
Output is correct |
9 |
Correct |
3211 ms |
500 KB |
Output is correct |
10 |
Correct |
3156 ms |
360 KB |
Output is correct |
11 |
Correct |
3098 ms |
372 KB |
Output is correct |
12 |
Correct |
2996 ms |
372 KB |
Output is correct |
13 |
Correct |
3194 ms |
376 KB |
Output is correct |
14 |
Correct |
3113 ms |
504 KB |
Output is correct |
15 |
Correct |
3326 ms |
464 KB |
Output is correct |
16 |
Correct |
3238 ms |
376 KB |
Output is correct |
17 |
Correct |
3123 ms |
380 KB |
Output is correct |
18 |
Correct |
3081 ms |
372 KB |
Output is correct |
19 |
Execution timed out |
9072 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9068 ms |
592 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
208 KB |
Output is correct |
2 |
Correct |
201 ms |
312 KB |
Output is correct |
3 |
Correct |
2787 ms |
384 KB |
Output is correct |
4 |
Correct |
2789 ms |
504 KB |
Output is correct |
5 |
Correct |
2782 ms |
496 KB |
Output is correct |
6 |
Correct |
2805 ms |
500 KB |
Output is correct |
7 |
Correct |
2944 ms |
388 KB |
Output is correct |
8 |
Correct |
3226 ms |
380 KB |
Output is correct |
9 |
Correct |
3211 ms |
500 KB |
Output is correct |
10 |
Correct |
3156 ms |
360 KB |
Output is correct |
11 |
Correct |
3098 ms |
372 KB |
Output is correct |
12 |
Correct |
2996 ms |
372 KB |
Output is correct |
13 |
Correct |
3194 ms |
376 KB |
Output is correct |
14 |
Correct |
3113 ms |
504 KB |
Output is correct |
15 |
Correct |
3326 ms |
464 KB |
Output is correct |
16 |
Correct |
3238 ms |
376 KB |
Output is correct |
17 |
Correct |
3123 ms |
380 KB |
Output is correct |
18 |
Correct |
3081 ms |
372 KB |
Output is correct |
19 |
Execution timed out |
9072 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |