#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
int n = A.size(), q = X.size();
vector<int> ans(q);
for(int it=0; it<q; it++) {
A[X[it]] = V[it];
vector<int> B = A;
while(!is_sorted(B.begin(), B.end())) {
ans[it]++;
for(int i=0; i+1<n; i++) if(B[i] > B[i+1]) swap(B[i], B[i+1]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
440 KB |
Output is correct |
2 |
Correct |
438 ms |
348 KB |
Output is correct |
3 |
Correct |
6144 ms |
344 KB |
Output is correct |
4 |
Correct |
6190 ms |
344 KB |
Output is correct |
5 |
Correct |
2704 ms |
348 KB |
Output is correct |
6 |
Correct |
413 ms |
344 KB |
Output is correct |
7 |
Correct |
983 ms |
516 KB |
Output is correct |
8 |
Correct |
1486 ms |
348 KB |
Output is correct |
9 |
Correct |
2682 ms |
348 KB |
Output is correct |
10 |
Correct |
2961 ms |
444 KB |
Output is correct |
11 |
Correct |
3038 ms |
512 KB |
Output is correct |
12 |
Correct |
2965 ms |
508 KB |
Output is correct |
13 |
Correct |
3055 ms |
344 KB |
Output is correct |
14 |
Correct |
2985 ms |
512 KB |
Output is correct |
15 |
Correct |
2937 ms |
344 KB |
Output is correct |
16 |
Correct |
2950 ms |
512 KB |
Output is correct |
17 |
Correct |
2954 ms |
348 KB |
Output is correct |
18 |
Correct |
2962 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
440 KB |
Output is correct |
2 |
Correct |
438 ms |
348 KB |
Output is correct |
3 |
Correct |
6144 ms |
344 KB |
Output is correct |
4 |
Correct |
6190 ms |
344 KB |
Output is correct |
5 |
Correct |
2704 ms |
348 KB |
Output is correct |
6 |
Correct |
413 ms |
344 KB |
Output is correct |
7 |
Correct |
983 ms |
516 KB |
Output is correct |
8 |
Correct |
1486 ms |
348 KB |
Output is correct |
9 |
Correct |
2682 ms |
348 KB |
Output is correct |
10 |
Correct |
2961 ms |
444 KB |
Output is correct |
11 |
Correct |
3038 ms |
512 KB |
Output is correct |
12 |
Correct |
2965 ms |
508 KB |
Output is correct |
13 |
Correct |
3055 ms |
344 KB |
Output is correct |
14 |
Correct |
2985 ms |
512 KB |
Output is correct |
15 |
Correct |
2937 ms |
344 KB |
Output is correct |
16 |
Correct |
2950 ms |
512 KB |
Output is correct |
17 |
Correct |
2954 ms |
348 KB |
Output is correct |
18 |
Correct |
2962 ms |
512 KB |
Output is correct |
19 |
Execution timed out |
9015 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9024 ms |
856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
440 KB |
Output is correct |
2 |
Correct |
438 ms |
348 KB |
Output is correct |
3 |
Correct |
6144 ms |
344 KB |
Output is correct |
4 |
Correct |
6190 ms |
344 KB |
Output is correct |
5 |
Correct |
2704 ms |
348 KB |
Output is correct |
6 |
Correct |
413 ms |
344 KB |
Output is correct |
7 |
Correct |
983 ms |
516 KB |
Output is correct |
8 |
Correct |
1486 ms |
348 KB |
Output is correct |
9 |
Correct |
2682 ms |
348 KB |
Output is correct |
10 |
Correct |
2961 ms |
444 KB |
Output is correct |
11 |
Correct |
3038 ms |
512 KB |
Output is correct |
12 |
Correct |
2965 ms |
508 KB |
Output is correct |
13 |
Correct |
3055 ms |
344 KB |
Output is correct |
14 |
Correct |
2985 ms |
512 KB |
Output is correct |
15 |
Correct |
2937 ms |
344 KB |
Output is correct |
16 |
Correct |
2950 ms |
512 KB |
Output is correct |
17 |
Correct |
2954 ms |
348 KB |
Output is correct |
18 |
Correct |
2962 ms |
512 KB |
Output is correct |
19 |
Execution timed out |
9015 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |