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