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;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using ld = long double;
#define all(x) (x).begin(),(x).end()
const int MN = 1e5 + 5, MOD = 1e9 + 7, BASE = 131;
vector<int> countScans (vector<int> A, vector<int> X, vector<int> V) {
int n = A.size();
vector<int> ret(n);
int q = X.size();
for (int j = 0; j < q; j++) {
A[X[j]] = V[j];
vector<pii> na(n);
for (int i = 0; i < n; i++) na[i] = {A[i],i};
stable_sort(all(na),[](const pii &a, const pii &b){return a.first < b.first;});
int ans = 0;
for (int i = 0; i < n; i++) ans = max(ans,na[i].second-i);
ret[j] = ans;
}
return ret;
}
# | 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... |