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;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (int) (2 * 1e9)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 100111
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
pii cur[maxn];
int solve(vector<int> &a){
int n = a.size();
for(int i = 0; i < n; i++)
cur[i] = mp(a[i], i);
sort(cur, cur + n);
int ret = 0;
for(int i = 0; i < n; i++){
// cout << i << " " << cur[i].fi << " " << cur[i].se << endl;
int diff = cur[i].se - i;
ret = max(ret, diff);
}
return ret;
}
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
int q = X.size();
vector<int> ans(q);
for(int i = 0; i < q; i++){
A[X[i]] = V[i];
ans[i] = solve(A);
}
return ans;
}
# | 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... |