# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
886949 | artixkrishna | Arranging Shoes (IOI19_shoes) | C++14 | 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define REP(i,a,b) for(int i=a; i<b; i++)
int count_swaps(vector<int> a){
ll swaps=0;
bool correct=false;
while(!correct){
d=0; e=1;
for(ll i=1; i<(int)a.size()/2; i++){
if(a[d]== -a[e]){
correct=true; d+=1; e+=1;continue;
}
correct=false;
ll b=a[e];
ll c=a[d];
a[e]=c;
a[d]=b;d+=2;e+=2;
swaps+=1;
}
}
return swaps;
}