Submission #143371

#TimeUsernameProblemLanguageResultExecution timeMemory
143371ondrahArranging Shoes (IOI19_shoes)C++14
10 / 100
2 ms376 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; for(int j = i+1; j < n; j++) { if(s[i] == -s[j]) { ans += j-i-1; if(s[i] > 0) ans++; s[i] = s[j] = n+2; break; } } } 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...