Submission #389721

#TimeUsernameProblemLanguageResultExecution timeMemory
389721muhammad_hokimiyonBubble Sort 2 (JOI18_bubblesort2)C++14
0 / 100
6998 ms812 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){ int Q=X.size(); vector<int> answer; int n = (int)A.size(); for(int i = 0; i < Q; i++){ A[X[i]] = V[i]; auto b = A; sort(b.begin(), b.end()); map<int, deque<int>> p; for(int j = 0; j < n; j++){ p[A[j]].push_back(j); } int res = 0; for(int j = 0; j < n; j++){ int x = p[b[j]][0]; if(x < j)res = max(res, j - x); if(abs(x - j) > 0)res = max(res, 1); p[b[j]].pop_front(); } answer.push_back(res); } 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...