#include "bubblesort2.h"
#include<bits/stdc++.h>
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int n = A.size();
int q = X.size();
std::vector<int> answer;
for (int i = 0; i < q; ++i)
{
A[X[i]] = V[i];
std::vector<int> B = A;
int ct = 0;
for (int j = 0; j < n; ++j)
{
bool s = false;
for (int k = 0; k < n-1; ++k)
{
if (B[k] > B[k+1]) {std::swap(B[k], B[k+1]); s = true;}
}
if (!s) {break;}
++ct;
}
answer.push_back(ct);
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
376 KB |
Output is correct |
2 |
Correct |
1302 ms |
616 KB |
Output is correct |
3 |
Execution timed out |
9029 ms |
616 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
376 KB |
Output is correct |
2 |
Correct |
1302 ms |
616 KB |
Output is correct |
3 |
Execution timed out |
9029 ms |
616 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9044 ms |
936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
341 ms |
376 KB |
Output is correct |
2 |
Correct |
1302 ms |
616 KB |
Output is correct |
3 |
Execution timed out |
9029 ms |
616 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |