# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
412355 | nichke | Bubble Sort 2 (JOI18_bubblesort2) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
vector<int> ans;
for (int i = 0; i < X.length(); i++) {
A[x[i]] = V[i];
int res = 0;
for (int j = 0; j < A.size(); j++) {
int cnt = 0;
for (int k = 0; k < j; k++) {
cnt += (A[k] > A[j]);
}
res = max(res, cnt);
}
ans.push_back(res);
}
return ans;
}