# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144522 | Boxworld | Arranging Shoes (IOI19_shoes) | C++14 | 1081 ms | 2684 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 ans=0;
vector<int> a;
int swapp(int l,int r){
int t=a[r];
for (int i=r;i>l;i--)a[i]=a[i-1];
a[l]=t;
}
long long count_swaps(vector<int> s){
a=s;
int n=s.size();
for (int i=0;i<n;i++)
if (i%2==0){
int j;
for (j=i+1;;j++)
if (a[i]+a[j]==0)break;
if (a[i]<0){
swapp(i+1,j);
ans+=j-i-1;
}else{
swapp(i,j);
ans+=j-i;
}
}
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... |