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;
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...u>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
namespace {
const int MXN = 500005;
int n;
vector<int> a;
int calc() {
vector<pii> dist;
FOR(i, 0, n) dist.push_back(mp(a[i], i));
sort(dist.begin(), dist.end());
int ans = 0;
FOR(i, 0, n) {
ans = max(ans, dist[i].sc - i);
}
return ans;
}
}
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
::a = A;
::n = A.size();
int q = X.size();
vector<int> ans;
FOR(i, 0, q) {
a[X[i]] = V[i];
ans.push_back(calc());
}
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... |