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 "shoes.h"
#include <bits/stdc++.h>
using namespace std;
int n;
long long count_swaps(vector<int> s) {
n = s.size()/2;
long long k=0;
for (int i=n+n-1;i>=1;i-=2) {
int p = s[i];
int q = p *-1;
int w = i-1;
while (s[w]!=q) w--;
while (w<i) {
swap(s[w],s[w+1]);
k++;
w++;
}
if (s[i]<0) k--;
}
return k;
}
# | 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... |