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"
using namespace std;
long long count_swaps(vector<int> s) {
int i,j,n=s.size(),ans=0;
for(i=0;i<n;i+=2){
if(s[i]<0){
for(j=i+1;j<n;j++){
if(s[j]==-1*s[i]) break;
}
for(;j>i+1;j--){
ans++;
swap(s[j],s[j-1]);
}
}
else{
for(j=i+1;j<n;j++){
if(s[j]==-1*s[i]) break;
}
for(;j>i;j--){
ans++;
swap(s[j],s[j-1]);
}
}
}
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... |