# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144528 | MohamedAhmed04 | Arranging Shoes (IOI19_shoes) | C++14 | 1082 ms | 2040 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 ;
long long count_swaps(vector<int> v)
{
int ans = 0 ;
for(int i = 0 ; i < v.size() ; ++i)
{
if(i&1)
continue ;
int idx ;
for(int j = i+1 ; j < v.size() ; ++j)
{
if(v[j] == -v[i])
{
idx = j ;
break ;
}
}
for(int j = idx-1 ; j > i ; --j)
{
swap(v[j], v[j+1]) ;
ans++ ;
}
if(v[i] > 0)
swap(v[i], v[i+1]), ans++ ;
}
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... |