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 <bits/stdc++.h>
using namespace std;
long long count_swaps(vector<int> S) {
int n = S.size();
long long tot = 0;
for (int i = 0; i < n; i+=2) {
for (int j = i+1; i < n; j++) {
if (S[j] != -S[i]) continue;
for (int k = j-1; k > i; k--) {
swap(S[k], S[k+1]); tot++;
}
if (S[i] > 0) tot++;
break;
}
}
return tot;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |