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 "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
const int INF = (int) 1e9 + 7;
vector<int> countScans(vector<int> a, vector<int> pos, vector<int> value){
int n = (int) a.size();
int q = (int) pos.size();
assert(q == (int) value.size());
vector<int> sol;
for (int it = 0; it < q; it++) {
a[pos[it]] = value[it];
int MN = INF;
int MX = 0;
for (int i = n - 1; i >= 0; i--) {
MN = min(MN, a[i]);
if (a[i] == MN) {
int bigger = 0;
for (int j = 0; j < i; j++) {
if (a[j] > a[i]) {
bigger++;
}
}
MX = max(MX, bigger);
}
}
sol.push_back(MX);
}
return sol;
}
# | 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... |