# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713435 | europium | 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"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;
using ll = long long;
// subtask 4 - 15 points
// ll count_swaps(vector<int> s) {
// ll n = s.size() / 2;
// return n * (n - 1) / 2;
// }
// subtask 3
ll count_swaps(vector<int> a) {
ll n = s.size();
ll closest = 0;
ll ans = 0;
for (ll i = 0; i < n; i++){
if (a[i] < 0){
ans += i - closest;
closest +=2 ;
}
}
return ans;
}