Submission #1040620

#TimeUsernameProblemLanguageResultExecution timeMemory
1040620LaMatematica14Arranging Shoes (IOI19_shoes)C++17
50 / 100
1097 ms3164 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> S) { int n = S.size(); long long tot = 0; for (int i = 0; i < n; i+=2) { for (int j = i+1; i < n; j++) { if (S[j] != -S[i]) continue; for (int k = j-1; k > i; k--) { swap(S[k], S[k+1]); tot++; } if (S[i] > 0) tot++; break; } } return tot; }
#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...