Submission #240823

#TimeUsernameProblemLanguageResultExecution timeMemory
240823zoomswkArranging Shoes (IOI19_shoes)C++17
50 / 100
1091 ms3192 KiB
#include "shoes.h" using namespace std; long long count_swaps(std::vector<int> s) { int n = (int)s.size(); long long res = 0; for(int i=0; i<n; i+=2){ int loc = -1; for(int j=i+1; j<n; j++) if(s[j] == -s[i]){ loc = j; break; } while(loc > i+1){ swap(s[loc], s[loc-1]); loc--; res++; } if(s[i] > 0) res++; } return res; }
#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...