# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1030680 | Zicrus | Arranging Shoes (IOI19_shoes) | C++17 | 0 ms | 0 KiB |
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"
using namespace std;
typedef long long ll;
ll count_swaps(vector<int> a) {
ll n = a.size() / 2;
vector<ll> leftPos;
ll res = 0;
for (int i = 0; i < a.size(); i++) {
if (a[i] < 0) leftPos.push_back(i);
}
for (int i = 0; i < n; i++) {
res += abs(leftPos[i] - 2*i);
}
return res;
}