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(vector<int> s) {
int n = (int)s.size();
int ans = 0;
for(int st = 0; st < n; st += 2) {
int pos = st + 1;
while(s[pos] != -s[st]) pos++;
for(int i = pos; i > st + 1; i--)
swap(s[i], s[i - 1]),
ans++;
if(s[st] > 0) swap(s[st], s[st + 1]), ans++;
}
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... |