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;
#define ll long long
long long count_swaps(std::vector<int> s) {
int n = s.size() / 2;
vector<int> l;
for(int i=0;i<2 * n;i++)
{
if(s[i] < 0)
l.push_back(i);
}
int j = 0;
ll ans = 0;
for(int i=0;i<2*n;i+=2)
{
if(s[i] != l[j])
ans += abs(l[j] - i);
j++;
}
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... |