Submission #884020

#TimeUsernameProblemLanguageResultExecution timeMemory
884020vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
17 / 100
9036 ms2904 KiB
#include "bubblesort2.h" #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int n; int a[500005]; int aib[500005]; int calcmax() { ordered_set s; int mxm=0; for(int i=0;i<n;i++) { s.insert(a[i]); int cv = s.order_of_key(a[i]); mxm = max(mxm, i-cv); } return mxm; } std::vector<int> countScans(std::vector<int> A, std::vector<int> qp, std::vector<int> qv){ int q=qp.size(); n=A.size(); for(int i=0;i<n;i++) a[i]=A[i]; std::vector<int> answer(q); for (int i=0;i<q;i++) { a[qp[i]] = qv[i]; answer[i] = calcmax(); } return answer; } /** 4 2 1 2 3 4 0 3 2 1 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...