Submission #757681

#TimeUsernameProblemLanguageResultExecution timeMemory
757681HanksburgerBubble Sort 2 (JOI18_bubblesort2)C++17
0 / 100
9038 ms1360 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; int last[500005]; map<int, int> mp; vector<int> ans; vector<int> countScans(vector<int> a, vector<int> x, vector<int> y) { int n=a.size(), m=x.size(), sz=0; for (int i=0; i<n; i++) mp[a[i]]=0; for (auto it=mp.begin(); it!=mp.end(); it++) mp[it->first]=(++sz); for (int i=0; i<n; i++) last[a[i]=mp[a[i]]]=i; for (int i=0; i<m; i++) { a[x[i]]=mp[y[i]]; int mx=0; for (int j=0; j<sz; j++) { int cnt=0; for (int k=0; k<last[j]; k++) if (a[k]>a[last[j]]) cnt++; mx=max(mx, cnt); } ans.push_back(mx); } 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...