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 <iostream>
using namespace std;
int b[1000100];
int a[1000100];
void shift(int l,int r)
{
for(int i=l;i<=r;i++)
{
b[i]=a[i];
}
for(int i=l+1;i<=r;i++)
{
a[i]=b[i-1];
}
a[l]=b[r];
}
long long count_swaps(vector<int> s) {
int n=s.size();
/*
if(n<2010){
for(int i=0;i<n;i++)
{
a[i]=s[i];
}
int mn=0;
for(int i=0;i<n;i++)
{
if(a[i]>0)
{
int e=-1;
for(int j=i+1;j<n;j++)
{
if(a[j]==-a[i])
{
e=j;
break;
}
}
shift(i,e);
mn+=e-i;
i++;
}
if(a[i]<0)
{
int e=-1;
for(int j=i+1;j<n;j++)
{
if(a[j]==-a[i])
{
e=j;
break;
}
}
shift(i+1,e);
mn+=e-i-1;
i++;
}
}
return mn;
}
else
{ */
int nn=n/2-1;
int yy= nn*(nn+1)/2;
return yy;
// }
}
# | 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... |