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;
long long count_swaps(vector<int> s){
int n=s.size();
vector<int> marked(n);
long long answer=0;
for(int i=0;i<n;i++){
if(!marked[i]){
for(int j=i+1;j<n;j++){
if(!marked[j]&&abs(s[j])==abs(s[i])&&(s[i]*s[j]<0)){
marked[j]=1;
if(s[i]<0&&s[j]>0){}
else ++answer;
break ;
}
else{
answer+=(marked[j]^1);
}
}
}
}
return answer;
}
# | 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... |