# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1219899 | islam_2010 | Arranging Shoes (IOI19_shoes) | C++20 | 0 ms | 0 KiB |
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(vector<int> s){
int n = s.size();
vector<pair<int, int>> v;
int c = 0;
for(int i = 0; i < n/2; i++){
for(int j = n/2 ; j < n; j++){
if(abs(s[i])==abs(s[j])){
c += (j-i-1);
break;
}
}
}return c;
}
signed main(){
int n;
cin >> n;
vector<int> v(n*2);
for(int i = 0; i < 2*n; i++){
cin >> v[i];
}cout << count_swaps(v);
}