Submission #779579

#TimeUsernameProblemLanguageResultExecution timeMemory
779579Minindu206Arranging Shoes (IOI19_shoes)C++14
45 / 100
18 ms3516 KiB
#include "shoes.h" #include <bits/stdc++.h> #define ll long long using namespace std; ll count_swaps(vector<int> s) { ll n = s.size() / 2; if (n == 1) return s[0] > 0; queue<int> ind; ll ans = 0LL; for (int i = 0; i < 2 * n; i++) if (s[i] < 0) ind.push(i); for (int i = 0; i < 2 * n; i += 2) { int cur = ind.front(); ind.pop(); ans += (abs(cur - 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...