#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-j-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 |
174 ms |
356 KB |
Output is correct |
2 |
Correct |
570 ms |
640 KB |
Output is correct |
3 |
Correct |
7728 ms |
640 KB |
Output is correct |
4 |
Correct |
8020 ms |
868 KB |
Output is correct |
5 |
Correct |
5318 ms |
868 KB |
Output is correct |
6 |
Correct |
788 ms |
868 KB |
Output is correct |
7 |
Correct |
2008 ms |
980 KB |
Output is correct |
8 |
Correct |
3180 ms |
1008 KB |
Output is correct |
9 |
Correct |
5565 ms |
1100 KB |
Output is correct |
10 |
Correct |
6678 ms |
1144 KB |
Output is correct |
11 |
Correct |
6624 ms |
1228 KB |
Output is correct |
12 |
Correct |
6606 ms |
1232 KB |
Output is correct |
13 |
Correct |
6539 ms |
1296 KB |
Output is correct |
14 |
Correct |
6545 ms |
1296 KB |
Output is correct |
15 |
Correct |
6474 ms |
1348 KB |
Output is correct |
16 |
Correct |
6700 ms |
1512 KB |
Output is correct |
17 |
Correct |
6666 ms |
1512 KB |
Output is correct |
18 |
Correct |
6641 ms |
1592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
174 ms |
356 KB |
Output is correct |
2 |
Correct |
570 ms |
640 KB |
Output is correct |
3 |
Correct |
7728 ms |
640 KB |
Output is correct |
4 |
Correct |
8020 ms |
868 KB |
Output is correct |
5 |
Correct |
5318 ms |
868 KB |
Output is correct |
6 |
Correct |
788 ms |
868 KB |
Output is correct |
7 |
Correct |
2008 ms |
980 KB |
Output is correct |
8 |
Correct |
3180 ms |
1008 KB |
Output is correct |
9 |
Correct |
5565 ms |
1100 KB |
Output is correct |
10 |
Correct |
6678 ms |
1144 KB |
Output is correct |
11 |
Correct |
6624 ms |
1228 KB |
Output is correct |
12 |
Correct |
6606 ms |
1232 KB |
Output is correct |
13 |
Correct |
6539 ms |
1296 KB |
Output is correct |
14 |
Correct |
6545 ms |
1296 KB |
Output is correct |
15 |
Correct |
6474 ms |
1348 KB |
Output is correct |
16 |
Correct |
6700 ms |
1512 KB |
Output is correct |
17 |
Correct |
6666 ms |
1512 KB |
Output is correct |
18 |
Correct |
6641 ms |
1592 KB |
Output is correct |
19 |
Execution timed out |
9037 ms |
1592 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9037 ms |
1716 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
174 ms |
356 KB |
Output is correct |
2 |
Correct |
570 ms |
640 KB |
Output is correct |
3 |
Correct |
7728 ms |
640 KB |
Output is correct |
4 |
Correct |
8020 ms |
868 KB |
Output is correct |
5 |
Correct |
5318 ms |
868 KB |
Output is correct |
6 |
Correct |
788 ms |
868 KB |
Output is correct |
7 |
Correct |
2008 ms |
980 KB |
Output is correct |
8 |
Correct |
3180 ms |
1008 KB |
Output is correct |
9 |
Correct |
5565 ms |
1100 KB |
Output is correct |
10 |
Correct |
6678 ms |
1144 KB |
Output is correct |
11 |
Correct |
6624 ms |
1228 KB |
Output is correct |
12 |
Correct |
6606 ms |
1232 KB |
Output is correct |
13 |
Correct |
6539 ms |
1296 KB |
Output is correct |
14 |
Correct |
6545 ms |
1296 KB |
Output is correct |
15 |
Correct |
6474 ms |
1348 KB |
Output is correct |
16 |
Correct |
6700 ms |
1512 KB |
Output is correct |
17 |
Correct |
6666 ms |
1512 KB |
Output is correct |
18 |
Correct |
6641 ms |
1592 KB |
Output is correct |
19 |
Execution timed out |
9037 ms |
1592 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |