#include "bubblesort2.h"
using namespace std;
std::vector<int> countScans(std::vector<int> a,std::vector<int> x,std::vector<int> v){
int n = a.size(), q = x.size();
vector <int> s(q);
for(int f = 0; f < q; ++f) {
a[x[f]] = v[f];
int cnt = 0;
vector<int> b = a;
for(int i = 0; i < n; ++i) {
bool flag = 0;
for (int j = 0; j + 1 < n; ++j) {
if (a[j] > a[j + 1]) {
swap(a[j], a[j + 1]);
flag = 1;
}
}
if (!flag) {break;}
++cnt;
}
swap(a, b);
s[f] = cnt;
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
317 ms |
364 KB |
Output is correct |
2 |
Correct |
1195 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
9098 ms |
364 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
317 ms |
364 KB |
Output is correct |
2 |
Correct |
1195 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
9098 ms |
364 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9006 ms |
620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
317 ms |
364 KB |
Output is correct |
2 |
Correct |
1195 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
9098 ms |
364 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |