This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bubblesort2.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v){
int n = a.size(), q = x.size();
vector<int> ans;
for(int qq = 0; qq < q; qq++){
a[x[qq]] = v[qq];
auto aa = a;
int cur = 0;
for(int i = 0; i < n; i++){
bool bl = 0;
for(int j = 0; j+1 < n; j++) if(aa[j] > aa[j+1]){
bl = 1;
swap(aa[j], aa[j+1]);
}
if(bl) cur++;
else break;
}
ans.pb(cur);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |