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;
int mi(vector<int> vi, int d){
int n=vi.size(), mini=2e9;
bool is=true;
for(int i=0; i<n; i+=2){
if(vi[i]>0 || vi[i+1]<0 || -vi[i]!=vi[i+1])
is=false;
}
if(is)
return d;
if(d==8)
return 2000000000;
for(int i=0; i<n-1; i++){
swap(vi[i], vi[i+1]);
mini=min(mini, mi(vi, d+1));
swap(vi[i], vi[i+1]);
}
return mini;
}
long long count_swaps(vector<int> s) {
int hi=mi(s, 0);
if(hi!=2000000000)
return mi(s, 0);
else
return 8;
}
# | 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... |