#include "bubblesort2.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace __gnu_pbds;
using namespace std;
using Set = tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update>;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
std::vector<int> ans(Q);
int n = A.size();
for (int _=0;_<Q;_++) {
A[X[_]] = V[_];
ans[_] = 0;
Set s;
for(int i = 0;i < n;i++){
ans[_] = max(ans[_], int(s.size()-s.order_of_key({A[i]+1, -1})));
s.insert({A[i],i});
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
344 KB |
Output is correct |
2 |
Correct |
76 ms |
348 KB |
Output is correct |
3 |
Correct |
614 ms |
648 KB |
Output is correct |
4 |
Correct |
615 ms |
632 KB |
Output is correct |
5 |
Correct |
641 ms |
636 KB |
Output is correct |
6 |
Correct |
663 ms |
640 KB |
Output is correct |
7 |
Correct |
686 ms |
636 KB |
Output is correct |
8 |
Correct |
661 ms |
636 KB |
Output is correct |
9 |
Correct |
619 ms |
636 KB |
Output is correct |
10 |
Correct |
580 ms |
636 KB |
Output is correct |
11 |
Correct |
566 ms |
632 KB |
Output is correct |
12 |
Correct |
527 ms |
632 KB |
Output is correct |
13 |
Correct |
582 ms |
632 KB |
Output is correct |
14 |
Correct |
565 ms |
604 KB |
Output is correct |
15 |
Correct |
565 ms |
600 KB |
Output is correct |
16 |
Correct |
534 ms |
624 KB |
Output is correct |
17 |
Correct |
551 ms |
628 KB |
Output is correct |
18 |
Correct |
580 ms |
624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
344 KB |
Output is correct |
2 |
Correct |
76 ms |
348 KB |
Output is correct |
3 |
Correct |
614 ms |
648 KB |
Output is correct |
4 |
Correct |
615 ms |
632 KB |
Output is correct |
5 |
Correct |
641 ms |
636 KB |
Output is correct |
6 |
Correct |
663 ms |
640 KB |
Output is correct |
7 |
Correct |
686 ms |
636 KB |
Output is correct |
8 |
Correct |
661 ms |
636 KB |
Output is correct |
9 |
Correct |
619 ms |
636 KB |
Output is correct |
10 |
Correct |
580 ms |
636 KB |
Output is correct |
11 |
Correct |
566 ms |
632 KB |
Output is correct |
12 |
Correct |
527 ms |
632 KB |
Output is correct |
13 |
Correct |
582 ms |
632 KB |
Output is correct |
14 |
Correct |
565 ms |
604 KB |
Output is correct |
15 |
Correct |
565 ms |
600 KB |
Output is correct |
16 |
Correct |
534 ms |
624 KB |
Output is correct |
17 |
Correct |
551 ms |
628 KB |
Output is correct |
18 |
Correct |
580 ms |
624 KB |
Output is correct |
19 |
Execution timed out |
9004 ms |
1112 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9035 ms |
2396 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
344 KB |
Output is correct |
2 |
Correct |
76 ms |
348 KB |
Output is correct |
3 |
Correct |
614 ms |
648 KB |
Output is correct |
4 |
Correct |
615 ms |
632 KB |
Output is correct |
5 |
Correct |
641 ms |
636 KB |
Output is correct |
6 |
Correct |
663 ms |
640 KB |
Output is correct |
7 |
Correct |
686 ms |
636 KB |
Output is correct |
8 |
Correct |
661 ms |
636 KB |
Output is correct |
9 |
Correct |
619 ms |
636 KB |
Output is correct |
10 |
Correct |
580 ms |
636 KB |
Output is correct |
11 |
Correct |
566 ms |
632 KB |
Output is correct |
12 |
Correct |
527 ms |
632 KB |
Output is correct |
13 |
Correct |
582 ms |
632 KB |
Output is correct |
14 |
Correct |
565 ms |
604 KB |
Output is correct |
15 |
Correct |
565 ms |
600 KB |
Output is correct |
16 |
Correct |
534 ms |
624 KB |
Output is correct |
17 |
Correct |
551 ms |
628 KB |
Output is correct |
18 |
Correct |
580 ms |
624 KB |
Output is correct |
19 |
Execution timed out |
9004 ms |
1112 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |