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;
long long i = 0;
//while(!(Ordenado(s))){
for(long long j = i; j < n; j++){
//cout<<j<<" j\n";
if(j % 2 == 0){
if(s[j] < 0) i++;
else {
for(long long k = j; k < n; k++){
if(s[k] < 0){
for(long long l = k; l > j; l--){
swap(s[k], s[k - 1]);
Contador++;
}
break;
}
}
//break;
}
} else {
if(s[j] == -s[j - 1]) i++;
else {
for(long long k = j; k < n; k++){
if(s[k] == -s[j - 1]){
for(long long l = k; l > j; l--){
swap(s[k], s[k - 1]);
Contador++;
}
break;
}
}
//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... |