#include<bits/stdc++.h>
#include "bubblesort2.h"
using namespace std ;
int n;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
n = (int) A.size() ;
std::vector<int> answer(Q);
for (int j=0;j<Q;j++) {
A[ X[j] ] = V[ j ] ;
vector<pair<int , int > > tmp ;
int ret = 0 ;
for(int i = 0 ; i < n ;i++){
tmp.push_back({A[i] , i}) ;
}
sort(tmp.begin() , tmp.end()) ;
for(int i = 0 ;i < n ;i++){
ret = max(ret , tmp[i].second - i) ;
}
answer[j] = ret ;
}
return answer;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
45 ms |
256 KB |
Output is correct |
3 |
Correct |
273 ms |
504 KB |
Output is correct |
4 |
Correct |
272 ms |
504 KB |
Output is correct |
5 |
Correct |
262 ms |
504 KB |
Output is correct |
6 |
Correct |
194 ms |
504 KB |
Output is correct |
7 |
Correct |
241 ms |
496 KB |
Output is correct |
8 |
Correct |
252 ms |
504 KB |
Output is correct |
9 |
Correct |
278 ms |
504 KB |
Output is correct |
10 |
Correct |
184 ms |
632 KB |
Output is correct |
11 |
Correct |
181 ms |
504 KB |
Output is correct |
12 |
Correct |
182 ms |
504 KB |
Output is correct |
13 |
Correct |
178 ms |
504 KB |
Output is correct |
14 |
Correct |
176 ms |
504 KB |
Output is correct |
15 |
Correct |
176 ms |
504 KB |
Output is correct |
16 |
Correct |
165 ms |
504 KB |
Output is correct |
17 |
Correct |
171 ms |
504 KB |
Output is correct |
18 |
Correct |
164 ms |
504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
45 ms |
256 KB |
Output is correct |
3 |
Correct |
273 ms |
504 KB |
Output is correct |
4 |
Correct |
272 ms |
504 KB |
Output is correct |
5 |
Correct |
262 ms |
504 KB |
Output is correct |
6 |
Correct |
194 ms |
504 KB |
Output is correct |
7 |
Correct |
241 ms |
496 KB |
Output is correct |
8 |
Correct |
252 ms |
504 KB |
Output is correct |
9 |
Correct |
278 ms |
504 KB |
Output is correct |
10 |
Correct |
184 ms |
632 KB |
Output is correct |
11 |
Correct |
181 ms |
504 KB |
Output is correct |
12 |
Correct |
182 ms |
504 KB |
Output is correct |
13 |
Correct |
178 ms |
504 KB |
Output is correct |
14 |
Correct |
176 ms |
504 KB |
Output is correct |
15 |
Correct |
176 ms |
504 KB |
Output is correct |
16 |
Correct |
165 ms |
504 KB |
Output is correct |
17 |
Correct |
171 ms |
504 KB |
Output is correct |
18 |
Correct |
164 ms |
504 KB |
Output is correct |
19 |
Correct |
3850 ms |
844 KB |
Output is correct |
20 |
Correct |
5064 ms |
904 KB |
Output is correct |
21 |
Correct |
4432 ms |
896 KB |
Output is correct |
22 |
Correct |
4921 ms |
1016 KB |
Output is correct |
23 |
Correct |
3243 ms |
888 KB |
Output is correct |
24 |
Correct |
3261 ms |
888 KB |
Output is correct |
25 |
Correct |
3205 ms |
868 KB |
Output is correct |
26 |
Correct |
3288 ms |
864 KB |
Output is correct |
27 |
Correct |
3201 ms |
864 KB |
Output is correct |
28 |
Correct |
3201 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6418 ms |
1584 KB |
Output is correct |
2 |
Execution timed out |
9003 ms |
2600 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
384 KB |
Output is correct |
2 |
Correct |
45 ms |
256 KB |
Output is correct |
3 |
Correct |
273 ms |
504 KB |
Output is correct |
4 |
Correct |
272 ms |
504 KB |
Output is correct |
5 |
Correct |
262 ms |
504 KB |
Output is correct |
6 |
Correct |
194 ms |
504 KB |
Output is correct |
7 |
Correct |
241 ms |
496 KB |
Output is correct |
8 |
Correct |
252 ms |
504 KB |
Output is correct |
9 |
Correct |
278 ms |
504 KB |
Output is correct |
10 |
Correct |
184 ms |
632 KB |
Output is correct |
11 |
Correct |
181 ms |
504 KB |
Output is correct |
12 |
Correct |
182 ms |
504 KB |
Output is correct |
13 |
Correct |
178 ms |
504 KB |
Output is correct |
14 |
Correct |
176 ms |
504 KB |
Output is correct |
15 |
Correct |
176 ms |
504 KB |
Output is correct |
16 |
Correct |
165 ms |
504 KB |
Output is correct |
17 |
Correct |
171 ms |
504 KB |
Output is correct |
18 |
Correct |
164 ms |
504 KB |
Output is correct |
19 |
Correct |
3850 ms |
844 KB |
Output is correct |
20 |
Correct |
5064 ms |
904 KB |
Output is correct |
21 |
Correct |
4432 ms |
896 KB |
Output is correct |
22 |
Correct |
4921 ms |
1016 KB |
Output is correct |
23 |
Correct |
3243 ms |
888 KB |
Output is correct |
24 |
Correct |
3261 ms |
888 KB |
Output is correct |
25 |
Correct |
3205 ms |
868 KB |
Output is correct |
26 |
Correct |
3288 ms |
864 KB |
Output is correct |
27 |
Correct |
3201 ms |
864 KB |
Output is correct |
28 |
Correct |
3201 ms |
888 KB |
Output is correct |
29 |
Correct |
6418 ms |
1584 KB |
Output is correct |
30 |
Execution timed out |
9003 ms |
2600 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |