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;
typedef long long ll;
const int mxN = 100005;
ll count_swaps(vector<int> s) {
int n = int(s.size());
if(n == 2) {
if(s[0] > 0)
return 1;
return 0;
} else {
vector<int> neg, pos;
for(int i = 0; i < n; i++) {
if(s[i] < 0)
neg.push_back(i);
else
pos.push_back(i);
}
ll ans = 0;
for(int i = 0; i < n/2; i++)
ans += abs(neg[i]-pos[i]-1);
return ans;
}
assert(true);
}
# | 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... |