Submission #298252

#TimeUsernameProblemLanguageResultExecution timeMemory
298252emil_physmathArranging Shoes (IOI19_shoes)C++17
0 / 100
1 ms256 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; using llong = long long; long long count_swaps(vector<int> a) { int n = a.size(); llong ans = 0; vector<int> l, r; for (int i = 0; i < n; ++i) if (a[i] < 0) l.push_back(i); else r.push_back(i); for (int i = 0; i < n / 2; ++i) { ans += l[i] - 2 * i + (r[i] < l[i]); ans += r[i] - 2 * i; } 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...