제출 #992515

#제출 시각아이디문제언어결과실행 시간메모리
992515MuntherCarrotArranging Shoes (IOI19_shoes)C++14
10 / 100
1098 ms2760 KiB
#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--; } } ans = min(ans, cnt); }while(next_permutation(all(prm))); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...