Submission #403572

#TimeUsernameProblemLanguageResultExecution timeMemory
403572dxz05Arranging Shoes (IOI19_shoes)C++14
50 / 100
1087 ms3104 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long count_swaps(vector<int> a) { int n = a.size(); ll ans = 0; for (int i = 0; i < n; i += 2){ int j = i; while (a[j] != -a[i]) j++; while (j > i + 1){ swap(a[j - 1], a[j]); j--; ans++; } if (a[i] > 0){ ans++; swap(a[i], a[i + 1]); } } 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...