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"
long long count_swaps(std::vector<int> s) {
long long ans = 0;
int n = s.size();
for(int i = 0; i < n; i++) {
if(s[i] == n+2)
continue;
for(int j = i+1; j < n; j++) {
if(s[i] == -s[j]) {
ans += j-i-1;
if(s[i] > 0) ans++;
s[i] = s[j] = n+2;
break;
}
}
}
return ans;
}
# | 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... |