Submission #703995

#TimeUsernameProblemLanguageResultExecution timeMemory
703995mseebacherArranging Shoes (IOI19_shoes)C++17
10 / 100
1 ms300 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++){ if(!done[i]){ for(int j = i+1;j<n;j++){ if(s[i] + s[j] == 0 && !done[j]){ if(s[i] < 0){ erg += j-i-1; }else{ erg += j-i; } done[j] = 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...