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>
//#define int long long
#define ll long long
#define endl '\n'
#define pii pair<int,int>
#define vint vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define pb push_back
#define se second
#define fi first
#define all(x) x.begin(), x.end()
#define graph vector<vll>
using namespace std;
const int N = (int)2e5 + 69;
const int mod = (int)1e4 + 7;
const int naser = 3999, tourist = 3816;
int power(int a, int b) { int ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; }
vint countScans(vint a, vint x, vint v) {
int n = a.size();
int q = x.size();
vint ans(q);
for (int j = 0; j < q; j++) {
a[x[j]] = v[j];
vint b = a;
sort(all(b));
map<int, int> mp;
for (int i = 0; i < n; i++) {
mp[b[i]] = i;
}
for (int i = 0; i < n; i++) {
if (i > mp[a[i]])
ans[j] = max(ans[j], i - mp[a[i]]);
}
}
return ans;
}
//int32_t main() {
//
// vint ans = countScans({1,2,3,4}, {0,2}, {3,1});
// for (int x : ans)
// cout << x << endl;
//
//}
# | 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... |