#include "bubblesort2.h"
#include <set>
#include <map>
#include <algorithm>
#include <iterator>
#include <cstdio>
#include <cmath>
using namespace std;
int n, q;
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
vector<int> ans;
n = A.size();
q = X.size();
for(int i=0;i<q;i++){
A[X[i]] = V[i];
vector<int> srt;
for(int j=0;j<n;j++) srt.push_back(A[j]);
sort(srt.begin(), srt.end());
int mx = -1;
for(int j=0;j<n;j++){
vector<int>::iterator it;
it = lower_bound(srt.begin(), srt.end(), A[j]);
int x = it-srt.begin();
mx = max(mx, ((int) round(fabs(x-j))));
}
ans.push_back(mx);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8910 ms |
1332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
38 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |