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 <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#include "shoes.h"
long long count_swaps(vector<int> s){
long long n=s.size();
n/=2;
if(n==1){
if(s[0]<0){
return 0;
}
else{
return 1;
}
}
int x=s[0];
int st=0;
for(int i=0;i<2*n;i++){
if(s[i]!=x){
st=1;
}
}
if(st==0){
long long tot=0;
int ind=0;
for(int i=0;i<2*n;i++){
if(s[i]<0){
tot+=abs(i-ind);
ind+=2;
}
}
return tot;
}
return ((n*(n-1))/2);
}
# | 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... |