Submission #1054794

# Submission time Handle Problem Language Result Execution time Memory
1054794 2024-08-12T12:10:44 Z aymanrs Bubble Sort 2 (JOI18_bubblesort2) C++17
60 / 100
9000 ms 8532 KB
#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();
	int c[n]={0};
	for(int i = 1;i < n;i++){
		for(int j = 0;j < i;j++) c[i] += A[j]>A[i];
	}
	for (int  _=0;_<Q;_++) {
		ans[_] = 0;
		c[X[_]]=0;
		for(int i = 0;i < X[_];i++)	{
			c[X[_]] += A[i]>V[_];
			ans[_] = max(ans[_], c[i]);
		}
		ans[_] = max(ans[_], c[X[_]]);
		for(int i = X[_]+1;i < n;i++){
			c[i] -= A[X[_]]>A[i];
			c[i] += V[_]>A[i];
			ans[_] = max(ans[_], c[i]);
		}
		A[X[_]] = V[_];
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 5 ms 448 KB Output is correct
5 Correct 5 ms 448 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 5 ms 444 KB Output is correct
10 Correct 8 ms 528 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
13 Correct 4 ms 532 KB Output is correct
14 Correct 8 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 5 ms 532 KB Output is correct
18 Correct 8 ms 528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 5 ms 448 KB Output is correct
5 Correct 5 ms 448 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 5 ms 444 KB Output is correct
10 Correct 8 ms 528 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
13 Correct 4 ms 532 KB Output is correct
14 Correct 8 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 5 ms 532 KB Output is correct
18 Correct 8 ms 528 KB Output is correct
19 Correct 52 ms 804 KB Output is correct
20 Correct 70 ms 860 KB Output is correct
21 Correct 67 ms 860 KB Output is correct
22 Correct 68 ms 856 KB Output is correct
23 Correct 66 ms 852 KB Output is correct
24 Correct 66 ms 704 KB Output is correct
25 Correct 66 ms 852 KB Output is correct
26 Correct 67 ms 852 KB Output is correct
27 Correct 60 ms 852 KB Output is correct
28 Correct 61 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 880 KB Output is correct
2 Correct 1166 ms 1680 KB Output is correct
3 Correct 2712 ms 2548 KB Output is correct
4 Correct 2586 ms 2552 KB Output is correct
5 Correct 2578 ms 2560 KB Output is correct
6 Correct 2603 ms 2564 KB Output is correct
7 Correct 2661 ms 2396 KB Output is correct
8 Correct 2636 ms 2392 KB Output is correct
9 Correct 2666 ms 2560 KB Output is correct
10 Correct 2298 ms 2700 KB Output is correct
11 Correct 2295 ms 2648 KB Output is correct
12 Correct 2411 ms 2652 KB Output is correct
13 Correct 2256 ms 2628 KB Output is correct
14 Correct 2196 ms 2652 KB Output is correct
15 Correct 2222 ms 2396 KB Output is correct
16 Correct 2109 ms 2392 KB Output is correct
17 Correct 2137 ms 2392 KB Output is correct
18 Correct 2131 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 5 ms 492 KB Output is correct
4 Correct 5 ms 448 KB Output is correct
5 Correct 5 ms 448 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 5 ms 444 KB Output is correct
10 Correct 8 ms 528 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
13 Correct 4 ms 532 KB Output is correct
14 Correct 8 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 5 ms 532 KB Output is correct
18 Correct 8 ms 528 KB Output is correct
19 Correct 52 ms 804 KB Output is correct
20 Correct 70 ms 860 KB Output is correct
21 Correct 67 ms 860 KB Output is correct
22 Correct 68 ms 856 KB Output is correct
23 Correct 66 ms 852 KB Output is correct
24 Correct 66 ms 704 KB Output is correct
25 Correct 66 ms 852 KB Output is correct
26 Correct 67 ms 852 KB Output is correct
27 Correct 60 ms 852 KB Output is correct
28 Correct 61 ms 848 KB Output is correct
29 Correct 251 ms 880 KB Output is correct
30 Correct 1166 ms 1680 KB Output is correct
31 Correct 2712 ms 2548 KB Output is correct
32 Correct 2586 ms 2552 KB Output is correct
33 Correct 2578 ms 2560 KB Output is correct
34 Correct 2603 ms 2564 KB Output is correct
35 Correct 2661 ms 2396 KB Output is correct
36 Correct 2636 ms 2392 KB Output is correct
37 Correct 2666 ms 2560 KB Output is correct
38 Correct 2298 ms 2700 KB Output is correct
39 Correct 2295 ms 2648 KB Output is correct
40 Correct 2411 ms 2652 KB Output is correct
41 Correct 2256 ms 2628 KB Output is correct
42 Correct 2196 ms 2652 KB Output is correct
43 Correct 2222 ms 2396 KB Output is correct
44 Correct 2109 ms 2392 KB Output is correct
45 Correct 2137 ms 2392 KB Output is correct
46 Correct 2131 ms 2392 KB Output is correct
47 Execution timed out 9061 ms 8532 KB Time limit exceeded
48 Halted 0 ms 0 KB -