Submission #240817

#TimeUsernameProblemLanguageResultExecution timeMemory
240817zoomswkArranging Shoes (IOI19_shoes)C++17
30 / 100
34 ms1920 KiB
#include "shoes.h" using namespace std; long long count_swaps(std::vector<int> s) { int n = (int)s.size(); if(n > 1000) return 0; 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...