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;
long long count_swaps(std::vector<int> s) {
// int n = s.size()/2;
long long wynik = 0;
while(s.size()){
//printf("%d %d\n", s.size(), wynik);
int szukaj = -s[0];
for(int i=0;i<(int)s.size();i++){
if(s[i]==szukaj){
szukaj = i;
break;
}
}
if(s[0]>0)wynik++;
wynik+=szukaj-1;
s.erase(s.begin()+szukaj, s.begin()+szukaj+1);
s.erase(s.begin(), s.begin()+1);
}
return wynik;
}
# | 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... |