#include "bubblesort2.h"
#include<bits/stdc++.h>
using namespace std;
int A[109],a[50009], s[109];
std::vector<int> countScans(std::vector<int> A1,std::vector<int> X,std::vector<int> V){
vector<int> answer;
int n,q;
// cin >> n >> q;
n = A1.size();
q = X.size();
for(int i = 1; i <= n; i++)
a[i] = A1[i-1], A[a[i]]++;
for(int i = 0 ; i < q; i++){
int p, v;
p = X[i] +1;
v = V[i];
A[a[p]] --;
A[v] ++;
a[p] = v;
int M= 0;
for(int i = 0; i <= 100; i++)
s[i] = 0;
for(int i = 1; i <= n; i++){
int p = 1;
for(int j = 0; j < a[i]; j++){
p += A[j];
}
p += s[a[i]];
s[a[i]] ++;
M = max(M, i - p);
}
answer.push_back(M);
}
return answer;
// cout << M << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2832 ms |
1292 KB |
Output is correct |
2 |
Execution timed out |
9015 ms |
1632 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |