Submission #395438

#TimeUsernameProblemLanguageResultExecution timeMemory
395438luisgalanArranging Shoes (IOI19_shoes)C++14
50 / 100
1093 ms3268 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; typedef long long int ll; ll count_swaps(vector<int> s) { int n = s.size(); vector<bool> taken(n); ll ans = 0; for (int i = 0; i < n; i++) { if (taken[i]) continue; taken[i] = true; for (int j = i; j < n; j++) { if (taken[j]) continue; ans++; if (s[i] == -s[j]) { taken[j] = true; if (s[i] < 0) { ans--; } 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...