Submission #924607

#TimeUsernameProblemLanguageResultExecution timeMemory
924607LucaLucaMArranging Shoes (IOI19_shoes)C++17
50 / 100
1090 ms3248 KiB
#include "shoes.h" #include <iostream> typedef long long ll; ll count_swaps(std::vector<int> s) { ll answer = 0; for (int i = 0; i < (int) s.size(); i += 2) { int j = i + 1; while (s[i] != -s[j]) { j++; } if (s[i] < 0) { answer += j - i - 1; } else { answer += j - i; } while (j - 1 > i) { std::swap(s[j], s[j - 1]); j--; } if (s[i] > 0) { std::swap(s[i], s[i + 1]); } } return answer; }
#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...