Submission #211071

#TimeUsernameProblemLanguageResultExecution timeMemory
211071lyhArranging Shoes (IOI19_shoes)C++14
10 / 100
1085 ms3200 KiB
#include "shoes.h" #include<bits/stdc++.h> using namespace std; long long count_swaps(std::vector<int> S) { long long sum = 0; for (int i = 0; i < (int)S.size(); i += 2) { int k; for (k = i; k < (int)S.size(); k++) { if (S[k] < 0) break; } for (int j = k; j > i; j--) { swap(S[j], S[j - 1]); sum++; } for (k = i + 1; k < (int)S.size(); k++) { if (S[k] == -S[i]) { break; } } for (int j = k; j > i + 1; j--) { swap(S[j], S[j - 1]); sum++; } } return sum; }
#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...