Submission #143372

#TimeUsernameProblemLanguageResultExecution timeMemory
143372ondrahArranging Shoes (IOI19_shoes)C++14
50 / 100
1073 ms1948 KiB
#include "shoes.h" long long count_swaps(std::vector<int> s) { long long ans = 0; int n = s.size(); for(int i = 0; i < n; i++) { if(s[i] == n+2) continue; int pen = 0; for(int j = i+1; j < n; j++) { if(s[i] == -s[j]) { ans += pen; if(s[i] > 0) ans++; s[i] = s[j] = n+2; break; } if(s[j] != n+2) pen++; } } 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...