#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
vi countScans (vi a, vi wh, vi val) {
vll ve(a.begin(), a.end());
ll n = a.size();
ll Q = wh.size();
vi ans;
for (ll q = 0; q < Q; q++) {
ve[wh[q]] = val[q];
vector <pair <ll, ll> > th;
for (ll i = 0; i < n; i++) {
th.push_back({ ve[i], i });
}
sort(th.begin(), th.end());
ll qans = 0;
for (ll i = 0; i < n; i++) {
qans = max(qans, th[i].second - i);
}
ans.push_back(qans);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
516 KB |
Output is correct |
3 |
Correct |
180 ms |
604 KB |
Output is correct |
4 |
Correct |
189 ms |
604 KB |
Output is correct |
5 |
Correct |
180 ms |
604 KB |
Output is correct |
6 |
Correct |
114 ms |
604 KB |
Output is correct |
7 |
Correct |
147 ms |
600 KB |
Output is correct |
8 |
Correct |
158 ms |
604 KB |
Output is correct |
9 |
Correct |
176 ms |
608 KB |
Output is correct |
10 |
Correct |
119 ms |
580 KB |
Output is correct |
11 |
Correct |
119 ms |
576 KB |
Output is correct |
12 |
Correct |
113 ms |
600 KB |
Output is correct |
13 |
Correct |
106 ms |
600 KB |
Output is correct |
14 |
Correct |
118 ms |
604 KB |
Output is correct |
15 |
Correct |
115 ms |
344 KB |
Output is correct |
16 |
Correct |
101 ms |
604 KB |
Output is correct |
17 |
Correct |
104 ms |
604 KB |
Output is correct |
18 |
Correct |
96 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
516 KB |
Output is correct |
3 |
Correct |
180 ms |
604 KB |
Output is correct |
4 |
Correct |
189 ms |
604 KB |
Output is correct |
5 |
Correct |
180 ms |
604 KB |
Output is correct |
6 |
Correct |
114 ms |
604 KB |
Output is correct |
7 |
Correct |
147 ms |
600 KB |
Output is correct |
8 |
Correct |
158 ms |
604 KB |
Output is correct |
9 |
Correct |
176 ms |
608 KB |
Output is correct |
10 |
Correct |
119 ms |
580 KB |
Output is correct |
11 |
Correct |
119 ms |
576 KB |
Output is correct |
12 |
Correct |
113 ms |
600 KB |
Output is correct |
13 |
Correct |
106 ms |
600 KB |
Output is correct |
14 |
Correct |
118 ms |
604 KB |
Output is correct |
15 |
Correct |
115 ms |
344 KB |
Output is correct |
16 |
Correct |
101 ms |
604 KB |
Output is correct |
17 |
Correct |
104 ms |
604 KB |
Output is correct |
18 |
Correct |
96 ms |
344 KB |
Output is correct |
19 |
Correct |
2841 ms |
1072 KB |
Output is correct |
20 |
Correct |
3600 ms |
1220 KB |
Output is correct |
21 |
Correct |
3115 ms |
1132 KB |
Output is correct |
22 |
Correct |
3449 ms |
1128 KB |
Output is correct |
23 |
Correct |
2508 ms |
1216 KB |
Output is correct |
24 |
Correct |
2352 ms |
1100 KB |
Output is correct |
25 |
Correct |
2178 ms |
1280 KB |
Output is correct |
26 |
Correct |
2254 ms |
1372 KB |
Output is correct |
27 |
Correct |
2270 ms |
1084 KB |
Output is correct |
28 |
Correct |
2429 ms |
1084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4830 ms |
1940 KB |
Output is correct |
2 |
Execution timed out |
9060 ms |
3460 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
516 KB |
Output is correct |
3 |
Correct |
180 ms |
604 KB |
Output is correct |
4 |
Correct |
189 ms |
604 KB |
Output is correct |
5 |
Correct |
180 ms |
604 KB |
Output is correct |
6 |
Correct |
114 ms |
604 KB |
Output is correct |
7 |
Correct |
147 ms |
600 KB |
Output is correct |
8 |
Correct |
158 ms |
604 KB |
Output is correct |
9 |
Correct |
176 ms |
608 KB |
Output is correct |
10 |
Correct |
119 ms |
580 KB |
Output is correct |
11 |
Correct |
119 ms |
576 KB |
Output is correct |
12 |
Correct |
113 ms |
600 KB |
Output is correct |
13 |
Correct |
106 ms |
600 KB |
Output is correct |
14 |
Correct |
118 ms |
604 KB |
Output is correct |
15 |
Correct |
115 ms |
344 KB |
Output is correct |
16 |
Correct |
101 ms |
604 KB |
Output is correct |
17 |
Correct |
104 ms |
604 KB |
Output is correct |
18 |
Correct |
96 ms |
344 KB |
Output is correct |
19 |
Correct |
2841 ms |
1072 KB |
Output is correct |
20 |
Correct |
3600 ms |
1220 KB |
Output is correct |
21 |
Correct |
3115 ms |
1132 KB |
Output is correct |
22 |
Correct |
3449 ms |
1128 KB |
Output is correct |
23 |
Correct |
2508 ms |
1216 KB |
Output is correct |
24 |
Correct |
2352 ms |
1100 KB |
Output is correct |
25 |
Correct |
2178 ms |
1280 KB |
Output is correct |
26 |
Correct |
2254 ms |
1372 KB |
Output is correct |
27 |
Correct |
2270 ms |
1084 KB |
Output is correct |
28 |
Correct |
2429 ms |
1084 KB |
Output is correct |
29 |
Correct |
4830 ms |
1940 KB |
Output is correct |
30 |
Execution timed out |
9060 ms |
3460 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |