#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 8005;
int n, q, ans[N];
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
//Count for each i how many numbers to its left > a[i]
n = a.size(), q = x.size();
vector<int> lol;
fw (i, 0, n) {
fw (j, i + 1, n) if (a[i] > a[j]) ans[j]++;
}
fw (i, 0, q) {
int pos = x[i], val = v[i];
ans[pos] = 0;
fw (j, 0, pos) if (a[j] > val) ans[pos]++;
fw (j, pos + 1, n) {
if (a[pos] > a[j]) ans[j]--;
if (val > a[j]) ans[j]++;
}
a[pos] = val;
int res = 0;
fw (j, 0, n) res = max(res, ans[j]);
lol.pb(res);
}
return lol;
}
//signed main() {
// #ifdef BLU
// in("blu.inp");
// #endif
// ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
// vector<int> hi = countScans({1, 2, 3, 4}, {0, 3}, {1, 3});
// fa (i, hi) cout << i << "\n";
// return 0;
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
29 ms |
384 KB |
Output is correct |
4 |
Correct |
33 ms |
512 KB |
Output is correct |
5 |
Correct |
22 ms |
424 KB |
Output is correct |
6 |
Correct |
14 ms |
384 KB |
Output is correct |
7 |
Correct |
19 ms |
384 KB |
Output is correct |
8 |
Correct |
19 ms |
384 KB |
Output is correct |
9 |
Correct |
24 ms |
384 KB |
Output is correct |
10 |
Correct |
25 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
484 KB |
Output is correct |
12 |
Correct |
21 ms |
384 KB |
Output is correct |
13 |
Correct |
18 ms |
384 KB |
Output is correct |
14 |
Correct |
13 ms |
384 KB |
Output is correct |
15 |
Correct |
21 ms |
384 KB |
Output is correct |
16 |
Correct |
16 ms |
384 KB |
Output is correct |
17 |
Correct |
20 ms |
384 KB |
Output is correct |
18 |
Correct |
16 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
29 ms |
384 KB |
Output is correct |
4 |
Correct |
33 ms |
512 KB |
Output is correct |
5 |
Correct |
22 ms |
424 KB |
Output is correct |
6 |
Correct |
14 ms |
384 KB |
Output is correct |
7 |
Correct |
19 ms |
384 KB |
Output is correct |
8 |
Correct |
19 ms |
384 KB |
Output is correct |
9 |
Correct |
24 ms |
384 KB |
Output is correct |
10 |
Correct |
25 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
484 KB |
Output is correct |
12 |
Correct |
21 ms |
384 KB |
Output is correct |
13 |
Correct |
18 ms |
384 KB |
Output is correct |
14 |
Correct |
13 ms |
384 KB |
Output is correct |
15 |
Correct |
21 ms |
384 KB |
Output is correct |
16 |
Correct |
16 ms |
384 KB |
Output is correct |
17 |
Correct |
20 ms |
384 KB |
Output is correct |
18 |
Correct |
16 ms |
384 KB |
Output is correct |
19 |
Correct |
366 ms |
724 KB |
Output is correct |
20 |
Correct |
453 ms |
888 KB |
Output is correct |
21 |
Correct |
281 ms |
632 KB |
Output is correct |
22 |
Correct |
328 ms |
760 KB |
Output is correct |
23 |
Correct |
278 ms |
632 KB |
Output is correct |
24 |
Correct |
259 ms |
632 KB |
Output is correct |
25 |
Correct |
248 ms |
636 KB |
Output is correct |
26 |
Correct |
242 ms |
768 KB |
Output is correct |
27 |
Correct |
236 ms |
760 KB |
Output is correct |
28 |
Correct |
207 ms |
632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
29 ms |
384 KB |
Output is correct |
4 |
Correct |
33 ms |
512 KB |
Output is correct |
5 |
Correct |
22 ms |
424 KB |
Output is correct |
6 |
Correct |
14 ms |
384 KB |
Output is correct |
7 |
Correct |
19 ms |
384 KB |
Output is correct |
8 |
Correct |
19 ms |
384 KB |
Output is correct |
9 |
Correct |
24 ms |
384 KB |
Output is correct |
10 |
Correct |
25 ms |
384 KB |
Output is correct |
11 |
Correct |
21 ms |
484 KB |
Output is correct |
12 |
Correct |
21 ms |
384 KB |
Output is correct |
13 |
Correct |
18 ms |
384 KB |
Output is correct |
14 |
Correct |
13 ms |
384 KB |
Output is correct |
15 |
Correct |
21 ms |
384 KB |
Output is correct |
16 |
Correct |
16 ms |
384 KB |
Output is correct |
17 |
Correct |
20 ms |
384 KB |
Output is correct |
18 |
Correct |
16 ms |
384 KB |
Output is correct |
19 |
Correct |
366 ms |
724 KB |
Output is correct |
20 |
Correct |
453 ms |
888 KB |
Output is correct |
21 |
Correct |
281 ms |
632 KB |
Output is correct |
22 |
Correct |
328 ms |
760 KB |
Output is correct |
23 |
Correct |
278 ms |
632 KB |
Output is correct |
24 |
Correct |
259 ms |
632 KB |
Output is correct |
25 |
Correct |
248 ms |
636 KB |
Output is correct |
26 |
Correct |
242 ms |
768 KB |
Output is correct |
27 |
Correct |
236 ms |
760 KB |
Output is correct |
28 |
Correct |
207 ms |
632 KB |
Output is correct |
29 |
Runtime error |
11 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
30 |
Halted |
0 ms |
0 KB |
- |