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;
bool Ordenado(vector<int> s){
bool S_ = 1;
for(long long i = 0; i < (long long)s.size(); i += 2){ if(!(s[i] < 0 and s[i + 1] == -s[i])) S_ = 0; cout<<s[i]<<" "<<s[i + 1]<<" "; }
cout<<"\n";
return S_;
}
long long count_swaps(vector<int> s){
long long n = s.size();
if(n == 2){
if(s[0] < 0) return 0;
else return 1;
} else if(n <= 22){
long long Contador = 0;
for(long long i = 0; i < n; i++){
//cout<<j<<" j\n";
/*for(auto E: s) cout<<E<<" ";
cout<<"\n";*/
if(i % 2 == 0){
if(!(s[i] < 0)){
for(long long j = i; j < n; j++){
if(s[j] < 0){
for(long long k = j; k > i; k--){
swap(s[k], s[k - 1]);
Contador++;
}
break;
}
}
}
} else {
if(!(s[i] == -s[i - 1])){
for(long long j = i; j < n; j++){
if(s[j] == -s[i - 1]){
for(long long k = j; k > i; k--){
swap(s[k], s[k - 1]);
Contador++;
}
break;
}
}
}
}
}
return Contador;
}
return 1;
}
# | 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... |