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>
#define LL long long
using namespace std;
long long count_swaps(std::vector<int> s) {
LL n = s.size()/2,ans = 0;
int cnt = 0;
for(int i=0;i<n*2;i++){
if(s[i]<0){
for(int j=i;j>cnt*2;j--)
swap(s[j],s[j-1]),ans++;
int idx = find(s.begin()+cnt*2,s.end(),-s[cnt*2])-s.begin();
assert(idx>cnt*2);
for(int j = idx;j>cnt*2+1;j--)
swap(s[j],s[j-1]),ans++;
cnt++;
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |