Submission #1012131

#TimeUsernameProblemLanguageResultExecution timeMemory
1012131vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
22 / 100
35 ms4048 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector <ll>; using vi = vector <int>; vi countScans (vi a, vi wh, vi val) { vll ve(a.begin(), a.end()); ll n = a.size(); ll Q = wh.size(); vi ans; priority_queue <ll> pq[110]; vll freq(110, 0); for (ll i = 0; i < n; i++) { pq[ve[i]].push(i); freq[ve[i]]++; } for (ll q = 0; q < Q; q++) { freq[ve[wh[q]]]--; ve[wh[q]] = val[q]; freq[val[q]]++; pq[val[q]].push(wh[q]); vll ps(110, 0); ps[0] = freq[0]; for (ll i = 1; i < 107; i++) { ps[i] = ps[i-1] + freq[i]; } ll qans = 0; for (ll i = 0; i < 104; i++) { while (pq[i].size() && ve[pq[i].top()] != i) pq[i].pop(); if (pq[i].empty()) continue; qans = max(qans, pq[i].top()+1 - ps[i]); } ans.push_back(qans); } 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...