Submission #883328

#TimeUsernameProblemLanguageResultExecution timeMemory
883328AkibAzmainArranging Shoes (IOI19_shoes)C++17
50 / 100
1099 ms3264 KiB
#include <bits/stdc++.h> using namespace std; #include "shoes.h" long long count_swaps(std::vector<int> a) { int n = a.size () / 2; map < int, int > c; long long ans = 0; for (int i = 0; i < n; ++i) { int j = i * 2 + 1; while (a[j] != -a[i * 2]) ++j; while (j != i * 2 + 1) swap (a[j], a[j - 1]), --j, ++ans; if (a[i * 2] > 0) swap (a[i * 2], a[i * 2 + 1]), ++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...