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>
#include "bubblesort2.h"
using namespace std;
vector <int> countScans(vector<int> a, vector<int> x, vector<int> v) {
int n = a.size(), q = x.size();
vector <int> s(q);
for(int f = 0; f < q; ++f) {
a[x[f]] = v[f];
int cnt = 0;
vector<int> b = a;
for(int i = 0; i < n; ++i) {
for (int j = 0; j + 1 < n; ++j) {
if (a[j] > a[j + 1]) {
swap(a[j], a[j + 1]);
++cnt;
}
}
}
swap(a, b);
s[f] = cnt;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |