Submission #548090

#TimeUsernameProblemLanguageResultExecution timeMemory
548090blueBubble Sort 2 (JOI18_bubblesort2)C++17
38 / 100
6194 ms1168 KiB
#include "bubblesort2.h" #include <vector> #include <set> #include <map> #include <iostream> #include <algorithm> using namespace std; using vi = vector<int>; using pii = pair<int, int>; #define sz(x) int(x.size()) vi countScans(vi A, vi X, vi V) { int N = sz(A); int Q = sz(X); vi answer(Q); for(int j = 0; j < Q; j++) { A[X[j]] = V[j]; vector<pii> pos; for(int i = 0; i < N; i++) pos.push_back({A[i], i}); sort(pos.begin(), pos.end()); int res = 0; for(int i = 0; i < N; i++) { if(i > 0 && pos[i].first == pos[i-1].first) continue; res = max(res, pos[i].second - i); } answer[j] = 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...