Submission #1054794

#TimeUsernameProblemLanguageResultExecution timeMemory
1054794aymanrsBubble Sort 2 (JOI18_bubblesort2)C++17
60 / 100
9061 ms8532 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...