이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
std::vector<int> countScans(std::vector<int> a,std::vector<int> x,std::vector<int> v){
int n = a.size(), q = x.size();
vector <int> s(q, n - 1);
vector<int> b = a;
for(int f = 0; f < q; ++f) {
a[x[f]] = v[f];
b[x[f]] = v[f];
int cnt = 0;
for (int i = 0; i < n; ++i) {
bool flag = 0;
for (int j = 1; j < n; ++j) {
if (a[j] < a[j - 1]) {
swap(a[j], a[j - 1]);
flag = 1;
}
}
if (!flag) {break;}
++cnt;
}
s[f] = cnt;
a = b;
}
return s;
}
# | 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... |