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();
deque<int> q;
for (int i = 0; i < n; i++) {
q.push_back(s[i]);
}
int total = 0;
while (q.size() > 0) {
int w = q.front();
auto it = find(q.begin(), q.end(), w * -1);
int idx = distance(q.begin(), it);
total += idx - 1;
if (w > 0) {
total ++;
}
q.erase(it);
q.pop_front();
}
return total;
}
# | 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... |