#include "bubblesort2.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
int n = A.size();
std::vector<int> answer(Q);
orderedSet s;
vector<pair<int, int> > crt;
for (int i = 0; i < Q; i++)
{
A[X[i]] = V[i];
// cout << X[i] << ' ' << V[i] << '\n';
vector<pair<int , int> > nou(n);
for (int j = 0; j < n; j++)
{
nou[j] = {A[j] , j};
// cout << A[j] << ' ';
}
sort(nou.begin(), nou.end());
for (int j = 0; j < n; j++)
{
answer[i] = max(answer[i] , nou[j].second - j);
}
}
return answer;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
460 KB |
Output is correct |
3 |
Correct |
190 ms |
492 KB |
Output is correct |
4 |
Correct |
186 ms |
480 KB |
Output is correct |
5 |
Correct |
179 ms |
348 KB |
Output is correct |
6 |
Correct |
116 ms |
344 KB |
Output is correct |
7 |
Correct |
153 ms |
592 KB |
Output is correct |
8 |
Correct |
193 ms |
348 KB |
Output is correct |
9 |
Correct |
182 ms |
344 KB |
Output is correct |
10 |
Correct |
109 ms |
492 KB |
Output is correct |
11 |
Correct |
105 ms |
344 KB |
Output is correct |
12 |
Correct |
105 ms |
484 KB |
Output is correct |
13 |
Correct |
105 ms |
348 KB |
Output is correct |
14 |
Correct |
109 ms |
484 KB |
Output is correct |
15 |
Correct |
105 ms |
344 KB |
Output is correct |
16 |
Correct |
96 ms |
348 KB |
Output is correct |
17 |
Correct |
97 ms |
344 KB |
Output is correct |
18 |
Correct |
94 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
460 KB |
Output is correct |
3 |
Correct |
190 ms |
492 KB |
Output is correct |
4 |
Correct |
186 ms |
480 KB |
Output is correct |
5 |
Correct |
179 ms |
348 KB |
Output is correct |
6 |
Correct |
116 ms |
344 KB |
Output is correct |
7 |
Correct |
153 ms |
592 KB |
Output is correct |
8 |
Correct |
193 ms |
348 KB |
Output is correct |
9 |
Correct |
182 ms |
344 KB |
Output is correct |
10 |
Correct |
109 ms |
492 KB |
Output is correct |
11 |
Correct |
105 ms |
344 KB |
Output is correct |
12 |
Correct |
105 ms |
484 KB |
Output is correct |
13 |
Correct |
105 ms |
348 KB |
Output is correct |
14 |
Correct |
109 ms |
484 KB |
Output is correct |
15 |
Correct |
105 ms |
344 KB |
Output is correct |
16 |
Correct |
96 ms |
348 KB |
Output is correct |
17 |
Correct |
97 ms |
344 KB |
Output is correct |
18 |
Correct |
94 ms |
592 KB |
Output is correct |
19 |
Correct |
2664 ms |
656 KB |
Output is correct |
20 |
Correct |
3532 ms |
692 KB |
Output is correct |
21 |
Correct |
3036 ms |
688 KB |
Output is correct |
22 |
Correct |
3420 ms |
696 KB |
Output is correct |
23 |
Correct |
2045 ms |
692 KB |
Output is correct |
24 |
Correct |
2037 ms |
604 KB |
Output is correct |
25 |
Correct |
2017 ms |
684 KB |
Output is correct |
26 |
Correct |
2063 ms |
688 KB |
Output is correct |
27 |
Correct |
2067 ms |
688 KB |
Output is correct |
28 |
Correct |
2024 ms |
692 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4709 ms |
880 KB |
Output is correct |
2 |
Execution timed out |
9062 ms |
1368 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
28 ms |
460 KB |
Output is correct |
3 |
Correct |
190 ms |
492 KB |
Output is correct |
4 |
Correct |
186 ms |
480 KB |
Output is correct |
5 |
Correct |
179 ms |
348 KB |
Output is correct |
6 |
Correct |
116 ms |
344 KB |
Output is correct |
7 |
Correct |
153 ms |
592 KB |
Output is correct |
8 |
Correct |
193 ms |
348 KB |
Output is correct |
9 |
Correct |
182 ms |
344 KB |
Output is correct |
10 |
Correct |
109 ms |
492 KB |
Output is correct |
11 |
Correct |
105 ms |
344 KB |
Output is correct |
12 |
Correct |
105 ms |
484 KB |
Output is correct |
13 |
Correct |
105 ms |
348 KB |
Output is correct |
14 |
Correct |
109 ms |
484 KB |
Output is correct |
15 |
Correct |
105 ms |
344 KB |
Output is correct |
16 |
Correct |
96 ms |
348 KB |
Output is correct |
17 |
Correct |
97 ms |
344 KB |
Output is correct |
18 |
Correct |
94 ms |
592 KB |
Output is correct |
19 |
Correct |
2664 ms |
656 KB |
Output is correct |
20 |
Correct |
3532 ms |
692 KB |
Output is correct |
21 |
Correct |
3036 ms |
688 KB |
Output is correct |
22 |
Correct |
3420 ms |
696 KB |
Output is correct |
23 |
Correct |
2045 ms |
692 KB |
Output is correct |
24 |
Correct |
2037 ms |
604 KB |
Output is correct |
25 |
Correct |
2017 ms |
684 KB |
Output is correct |
26 |
Correct |
2063 ms |
688 KB |
Output is correct |
27 |
Correct |
2067 ms |
688 KB |
Output is correct |
28 |
Correct |
2024 ms |
692 KB |
Output is correct |
29 |
Correct |
4709 ms |
880 KB |
Output is correct |
30 |
Execution timed out |
9062 ms |
1368 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |