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>
using namespace std;
long long count_swaps(vector<int> s) {
int n = s.size();
vector<bool> done(n,0);
int erg = 0;
for(int i = 0;i<n;i++){
if(!done[i]){
for(int j = i+1;j<n;j++){
if(s[i] + s[j] == 0 && !done[j]){
if(s[i] < 0){
erg += j-i-1;
}else{
erg += j-i;
}
done[j] = 1;
break;
}
}
}
}
return erg;
}
# | 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... |