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"
using namespace std;
long long count_swaps(std::vector<int> s) {
int n = (int)s.size();
if(n > 2000) return 0;
long long res = 0;
for(int i=0; i<n; i+=2){
int loc = -1;
for(int j=i+1; j<n; j++) if(s[j] == -s[i]){ loc = j; break; }
while(loc > i+1){
swap(s[loc], s[loc-1]);
loc--;
res++;
}
if(s[i] > 0) res++;
}
return res;
}
# | 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... |