# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335463 | MohammadHijaz | Arranging Shoes (IOI19_shoes) | C++14 | 1093 ms | 1900 KiB |
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 x = s.size();
int last = 0;
long long ans = 0;
for (int i = 0; i < x; i += 2) {
int tar;
for (int j = i + 1; j < x; j++) {
if (s[j] == s[i]*-1) {
tar = j;
break;
}
}
while(i + 1 != tar) {
swap(s[tar] , s[tar - 1]);
tar--;
ans++;
}
if (s[i] > s[i + 1]) {
swap(s[i + 1] , s[i]);
ans++;
}
}
return ans;
}
Compilation message (stderr)
# | 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... |