# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992515 | MuntherCarrot | Arranging Shoes (IOI19_shoes) | C++14 | 1098 ms | 2760 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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(), x.end()
ll count_swaps(vector<int> vec){
auto prm = vec;
int n = vec.size();
sort(all(prm));
ll ans = LLONG_MAX;
do{
bool good = 1;
for(int i = 0; i < n; i += 2){
if(prm[i] > 0 || -prm[i] != prm[i + 1]){
good = 0;
}
}
if(good == 0) continue;
ll cnt = 0;
auto f = vec;
for(int i = 0; i < n; i++){
int j = i;
while(f[j] != prm[i]) j++;
while(j > i){
cnt++;
swap(f[j], f[j - 1]);
j--;
}
}
# | 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... |