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>
#define ll long long
using namespace std;
ll count_swaps(vector<int> s)
{
ll n = s.size() / 2;
if (n == 1)
return s[0] > 0;
queue<int> ind;
ll ans = 0LL;
for (int i = 0; i < 2 * n; i++)
if (s[i] < 0)
ind.push(i);
for (int i = 0; i < 2 * n; i += 2)
{
int cur = ind.front();
ind.pop();
ans += (abs(cur - i));
}
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... |