Submission #883938

#TimeUsernameProblemLanguageResultExecution timeMemory
883938vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
38 / 100
9026 ms2428 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; //#define int ll #define sz(x) ((x).size()) int get(vector<int> V) { int n = sz(V); vector<int> idx(n); iota(all(idx), 0); sort(all(idx), [&](int a, int b) { return V[a] < V[b] || (V[a] == V[b] && a < b); } ); int mx = 0, cnt = 0; for(auto x : idx) // cerr << V[x] << ' ' << x << ' ' << cnt << '\n', mx = max(mx, x - cnt), cnt++; return mx; } std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){ int Q=X.size(); std::vector<int> answer(Q); for (int j=0;j<Q;j++) { A[X[j]] = V[j]; answer[j] = get(A); } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...