제출 #670596

#제출 시각아이디문제언어결과실행 시간메모리
670596shrimbArranging Shoes (IOI19_shoes)C++17
10 / 100
1089 ms15420 KiB
#include "shoes.h" #include"bits/stdc++.h" using namespace std; int N; vector<int> A; int F (int mask) { if (mask + 1 == (1 << N)) return 0; vector<pair<int,int>> v; for (int i = 0 ; i < N ; i++) if (!(mask & (1 << i))) v.emplace_back(A[i], i); int M = v.size(); int ret = 10000; for (int j = 0 ; j < M ; j++) { for (int k = 0 ; k < M ; k++) { if (v[j].first == -v[k].first and v[j].first < 0) { int cost = j + k - (j < k); ret = min(ret, F(mask + (1 << v[j].second) + (1 << v[k].second)) + cost); } } } return ret; } long long count_swaps(std::vector<int> s) { N = s.size(); swap(s, A); return F(0); return 1; }
#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...