Submission #703997

#TimeUsernameProblemLanguageResultExecution timeMemory
703997mseebacherArranging Shoes (IOI19_shoes)C++17
50 / 100
1077 ms3156 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> s) { int n = s.size(); vector<bool> done(n,0); int erg = 0; for(int i = 0;i<n;i+=2){ if(!done[i]){ for(int j = i+1;j<n;j++){ if(s[i] + s[j] == 0){ if(s[i] < 0){ erg += j-i-1; }else{ erg += j-i; } //done[j] = 1; for(int h = j;h>i;h--){ swap(s[h],s[h-1]); } break; } } } } return erg; }
#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...