# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314572 | baibhav26062008 | Arranging Shoes (IOI19_shoes) | C++14 | 1 ms | 256 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;
ll count_swaps(std::vector<int> s) {
int n = s.size()/2;
ll ans,found;
for(ll i=0;i<2*n;i+=2)
{
for(ll j=i+1;j<2*n;j++)
{
if(abs(s[j])==abs(s[i]))
found=j;
if (s[j] > s[i]) ans++;
}
for(ll j=found;j>=i+1;j--)
swap(s[j],s[j-1]);
ans+= (found - i - 1);
}
return ans;
}
Compilation message (stderr)
# | 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... |