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>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
//#define int ll
#define sz(x) ((x).size())
int get(vector<int> V) {
int n = sz(V);
vector<int> idx(n);
iota(all(idx), 0);
sort(all(idx), [&](int a, int b) { return V[a] < V[b] || (V[a] == V[b] && a < b); } );
int mx = 0, cnt = 0;
for(auto x : idx)
// cerr << V[x] << ' ' << x << ' ' << cnt << '\n',
mx = max(mx, x - cnt),
cnt++;
return mx;
}
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
std::vector<int> answer(Q);
for (int j=0;j<Q;j++) {
A[X[j]] = V[j];
answer[j] = get(A);
}
return answer;
}
# | 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... |