Submission #496051

#TimeUsernameProblemLanguageResultExecution timeMemory
496051600MihneaBubble Sort 2 (JOI18_bubblesort2)C++17
17 / 100
9094 ms1308 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; const int INF = (int) 1e9 + 7; vector<int> countScans(vector<int> a, vector<int> pos, vector<int> value){ int n = (int) a.size(); int q = (int) pos.size(); assert(q == (int) value.size()); vector<int> sol; for (int it = 0; it < q; it++) { a[pos[it]] = value[it]; int MN = INF; int MX = 0; for (int i = n - 1; i >= 0; i--) { MN = min(MN, a[i]); if (a[i] == MN) { int bigger = 0; for (int j = 0; j < i; j++) { if (a[j] > a[i]) { bigger++; } } MX = max(MX, bigger); } } sol.push_back(MX); } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...