Submission #837868

#TimeUsernameProblemLanguageResultExecution timeMemory
837868DarkMatterArranging Shoes (IOI19_shoes)C++14
10 / 100
1 ms212 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; long long count_swaps(std::vector<int> v) { int n = v.size(); long long ans = 0; vector<int>l, r, idx(n / 2); for (int i = 0; i < n; i++) v[i] > 0 ? r.push_back(i) : l.push_back(i); for (int i = 0; i < n / 2; i++) { int dif = abs(l[i] - r[i]) - 1; ans += dif; if (l[i] > r[i]) ans++; } 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...