# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143501 | 2019-08-14T11:37:57 Z | shashwatchandra | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 0 ms | 0 KB |
#include "bubblesort2.h" #include <bits1/stdc++.h> using namespace std; #define REP(i,n) for(int i = 0;i < n;i++) vector<int> countScans(vector<int> a,vector<int> x,vector<int> v){ vector<int> answer; REP(i,x.size()){ a[x[i]] = v[i]; int ans = 0; REP(i,a.size()){ int cur = 0; REP(j,i){ if(a[j] > a[i])cur++; } ans = max(ans,cur); } answer.push_back(ans); } return answer; }