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>
#include "shoes.h"
using namespace std;
long long count_swaps(vector<int>v) {
int N=v.size();
long long t=0;
for(int i=0;i<N;i+=2){
for(int j=i+1;j<N;j++){
if(v[j]==-v[i]){
for(int k=j-1;k>i;k--){
swap(v[k],v[k+1]);
t++;
}
break;
}
}
if(v[i]>0){
swap(v[i],v[i+1]);
t++;
}
}
return t;
}
# | 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... |