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<bits/stdc++.h>
#include "shoes.h"
using namespace std;
typedef long long int ll;
ll count_swaps(vector<int> s) {
int n = s.size();
vector<bool> taken(n);
ll ans = 0;
for (int i = 0; i < n; i++) {
if (taken[i]) continue;
taken[i] = true;
for (int j = i; j < n; j++) {
if (taken[j]) continue;
ans++;
if (s[i] == -s[j]) {
taken[j] = true;
if (s[i] < 0) {
ans--;
}
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... |