Submission #1089997

#TimeUsernameProblemLanguageResultExecution timeMemory
1089997VMaksimoski008Bubble Sort 2 (JOI18_bubblesort2)C++17
38 / 100
650 ms868 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int maxn = 5e5 + 5; vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) { int n = A.size(), q = X.size(); vector<int> ans(q); //goody ahh ideja, sto bi kazal bratot Nikola vector<int> p(n); for(int i=0; i<n; i++) for(int j=0; j<n; j++) p[i] += (A[j] < A[i]); for(int it=0; it<q; it++) { for(int i=0; i<n; i++) p[i] -= (A[X[it]] < A[i]); A[X[it]] = V[it]; p[X[it]] = 0; for(int i=0; i<n; i++) p[X[it]] += (A[i] < A[X[it]]); for(int i=0; i<n; i++) p[i] += (A[X[it]] < A[i]); for(int i=0; i<n; i++) ans[it] = max(ans[it], i - p[i]); } 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...