#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f first
#define s second
#define pb push_back
#define ep emplace
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define mem(f,x) memset(f , x , sizeof(f))
#define sz(x) (int)(x).size()
#define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b))
#define mxx *max_element
#define mnn *min_element
#define cntbit(x) __builtin_popcountll(x)
#define len(x) (int)(x.length())
const int N = 2e5 + 100;
vector <int> countScans(vector <int> a, vector <int> x, vector <int> v) {
int n = sz(a), q = sz(x);
vector <int> save;
for (int i = 0; i < q; i++) {
a[x[i]] = v[i];
int ans = 0;
for (int j = 0; j < n; j++) {
int cnt = 0;
for (int k = 0; k < j; k++) {
cnt += (a[j] < a[k]);
}
ans = max(ans, cnt);
}
save.pb(ans);
}
return save;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
348 KB |
Output is correct |
2 |
Correct |
175 ms |
444 KB |
Output is correct |
3 |
Correct |
2453 ms |
348 KB |
Output is correct |
4 |
Correct |
2481 ms |
468 KB |
Output is correct |
5 |
Correct |
2478 ms |
716 KB |
Output is correct |
6 |
Correct |
2495 ms |
712 KB |
Output is correct |
7 |
Correct |
2515 ms |
472 KB |
Output is correct |
8 |
Correct |
2512 ms |
468 KB |
Output is correct |
9 |
Correct |
2480 ms |
468 KB |
Output is correct |
10 |
Correct |
2523 ms |
476 KB |
Output is correct |
11 |
Correct |
2506 ms |
700 KB |
Output is correct |
12 |
Correct |
2477 ms |
504 KB |
Output is correct |
13 |
Correct |
2457 ms |
760 KB |
Output is correct |
14 |
Correct |
2458 ms |
504 KB |
Output is correct |
15 |
Correct |
2505 ms |
756 KB |
Output is correct |
16 |
Correct |
2450 ms |
508 KB |
Output is correct |
17 |
Correct |
2466 ms |
512 KB |
Output is correct |
18 |
Correct |
2457 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
348 KB |
Output is correct |
2 |
Correct |
175 ms |
444 KB |
Output is correct |
3 |
Correct |
2453 ms |
348 KB |
Output is correct |
4 |
Correct |
2481 ms |
468 KB |
Output is correct |
5 |
Correct |
2478 ms |
716 KB |
Output is correct |
6 |
Correct |
2495 ms |
712 KB |
Output is correct |
7 |
Correct |
2515 ms |
472 KB |
Output is correct |
8 |
Correct |
2512 ms |
468 KB |
Output is correct |
9 |
Correct |
2480 ms |
468 KB |
Output is correct |
10 |
Correct |
2523 ms |
476 KB |
Output is correct |
11 |
Correct |
2506 ms |
700 KB |
Output is correct |
12 |
Correct |
2477 ms |
504 KB |
Output is correct |
13 |
Correct |
2457 ms |
760 KB |
Output is correct |
14 |
Correct |
2458 ms |
504 KB |
Output is correct |
15 |
Correct |
2505 ms |
756 KB |
Output is correct |
16 |
Correct |
2450 ms |
508 KB |
Output is correct |
17 |
Correct |
2466 ms |
512 KB |
Output is correct |
18 |
Correct |
2457 ms |
856 KB |
Output is correct |
19 |
Execution timed out |
9035 ms |
744 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9070 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
348 KB |
Output is correct |
2 |
Correct |
175 ms |
444 KB |
Output is correct |
3 |
Correct |
2453 ms |
348 KB |
Output is correct |
4 |
Correct |
2481 ms |
468 KB |
Output is correct |
5 |
Correct |
2478 ms |
716 KB |
Output is correct |
6 |
Correct |
2495 ms |
712 KB |
Output is correct |
7 |
Correct |
2515 ms |
472 KB |
Output is correct |
8 |
Correct |
2512 ms |
468 KB |
Output is correct |
9 |
Correct |
2480 ms |
468 KB |
Output is correct |
10 |
Correct |
2523 ms |
476 KB |
Output is correct |
11 |
Correct |
2506 ms |
700 KB |
Output is correct |
12 |
Correct |
2477 ms |
504 KB |
Output is correct |
13 |
Correct |
2457 ms |
760 KB |
Output is correct |
14 |
Correct |
2458 ms |
504 KB |
Output is correct |
15 |
Correct |
2505 ms |
756 KB |
Output is correct |
16 |
Correct |
2450 ms |
508 KB |
Output is correct |
17 |
Correct |
2466 ms |
512 KB |
Output is correct |
18 |
Correct |
2457 ms |
856 KB |
Output is correct |
19 |
Execution timed out |
9035 ms |
744 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |