#include "bubblesort2.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
std::vector<int> ans(Q);
int n = A.size();
int cop[n];
for (int j=0;j<Q;j++) {
A[X[j]] = V[j];
for(int i = 0;i < n;i++) cop[i]=A[i];
ans[j]=0;
while(!is_sorted(cop, cop+n)){
ans[j]++;
for(int i = 0;i < n-1;i++) if(cop[i] > cop[i+1]) swap(cop[i],cop[i+1]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
148 ms |
436 KB |
Output is correct |
2 |
Correct |
652 ms |
348 KB |
Output is correct |
3 |
Correct |
7700 ms |
348 KB |
Output is correct |
4 |
Correct |
7827 ms |
516 KB |
Output is correct |
5 |
Correct |
4769 ms |
344 KB |
Output is correct |
6 |
Correct |
690 ms |
600 KB |
Output is correct |
7 |
Correct |
1854 ms |
516 KB |
Output is correct |
8 |
Correct |
3084 ms |
516 KB |
Output is correct |
9 |
Correct |
4843 ms |
348 KB |
Output is correct |
10 |
Correct |
8385 ms |
348 KB |
Output is correct |
11 |
Correct |
8461 ms |
504 KB |
Output is correct |
12 |
Correct |
8354 ms |
504 KB |
Output is correct |
13 |
Correct |
8344 ms |
504 KB |
Output is correct |
14 |
Correct |
8346 ms |
344 KB |
Output is correct |
15 |
Correct |
8392 ms |
344 KB |
Output is correct |
16 |
Correct |
8400 ms |
504 KB |
Output is correct |
17 |
Correct |
8380 ms |
348 KB |
Output is correct |
18 |
Correct |
8403 ms |
508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
148 ms |
436 KB |
Output is correct |
2 |
Correct |
652 ms |
348 KB |
Output is correct |
3 |
Correct |
7700 ms |
348 KB |
Output is correct |
4 |
Correct |
7827 ms |
516 KB |
Output is correct |
5 |
Correct |
4769 ms |
344 KB |
Output is correct |
6 |
Correct |
690 ms |
600 KB |
Output is correct |
7 |
Correct |
1854 ms |
516 KB |
Output is correct |
8 |
Correct |
3084 ms |
516 KB |
Output is correct |
9 |
Correct |
4843 ms |
348 KB |
Output is correct |
10 |
Correct |
8385 ms |
348 KB |
Output is correct |
11 |
Correct |
8461 ms |
504 KB |
Output is correct |
12 |
Correct |
8354 ms |
504 KB |
Output is correct |
13 |
Correct |
8344 ms |
504 KB |
Output is correct |
14 |
Correct |
8346 ms |
344 KB |
Output is correct |
15 |
Correct |
8392 ms |
344 KB |
Output is correct |
16 |
Correct |
8400 ms |
504 KB |
Output is correct |
17 |
Correct |
8380 ms |
348 KB |
Output is correct |
18 |
Correct |
8403 ms |
508 KB |
Output is correct |
19 |
Execution timed out |
9028 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9072 ms |
860 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
148 ms |
436 KB |
Output is correct |
2 |
Correct |
652 ms |
348 KB |
Output is correct |
3 |
Correct |
7700 ms |
348 KB |
Output is correct |
4 |
Correct |
7827 ms |
516 KB |
Output is correct |
5 |
Correct |
4769 ms |
344 KB |
Output is correct |
6 |
Correct |
690 ms |
600 KB |
Output is correct |
7 |
Correct |
1854 ms |
516 KB |
Output is correct |
8 |
Correct |
3084 ms |
516 KB |
Output is correct |
9 |
Correct |
4843 ms |
348 KB |
Output is correct |
10 |
Correct |
8385 ms |
348 KB |
Output is correct |
11 |
Correct |
8461 ms |
504 KB |
Output is correct |
12 |
Correct |
8354 ms |
504 KB |
Output is correct |
13 |
Correct |
8344 ms |
504 KB |
Output is correct |
14 |
Correct |
8346 ms |
344 KB |
Output is correct |
15 |
Correct |
8392 ms |
344 KB |
Output is correct |
16 |
Correct |
8400 ms |
504 KB |
Output is correct |
17 |
Correct |
8380 ms |
348 KB |
Output is correct |
18 |
Correct |
8403 ms |
508 KB |
Output is correct |
19 |
Execution timed out |
9028 ms |
600 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |