#include "bubblesort2.h"
#include <vector>
using namespace std;
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
int n = a.size();
int q = x.size();
vector<int> ret;
for(int t = 0; t < q; ++t) {
a[x[t]] = v[t];
vector<int> b = a;
int ans = 0;
for(int i = 0; i < n; ++i) {
bool sorted = 1;
for(int j = 0; j + 1 < n; ++j) {
if(b[j] > b[j + 1]) {
sorted = 0;
break;
}
}
if(sorted) {
break;
}
++ans;
for(int j = 0; j + 1 < n; ++j) {
if(b[j] > b[j + 1]) {
swap(b[j], b[j + 1]);
}
}
}
ret.push_back(ans);
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
286 ms |
364 KB |
Output is correct |
2 |
Correct |
1076 ms |
528 KB |
Output is correct |
3 |
Execution timed out |
9014 ms |
592 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
286 ms |
364 KB |
Output is correct |
2 |
Correct |
1076 ms |
528 KB |
Output is correct |
3 |
Execution timed out |
9014 ms |
592 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9084 ms |
620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
286 ms |
364 KB |
Output is correct |
2 |
Correct |
1076 ms |
528 KB |
Output is correct |
3 |
Execution timed out |
9014 ms |
592 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |