Submission #285668

#TimeUsernameProblemLanguageResultExecution timeMemory
285668Otaku619Arranging Shoes (IOI19_shoes)C++14
10 / 100
1076 ms3064 KiB
#include <bits/stdc++.h> using namespace std; long long count_swaps(vector<int> v) { int n = v.size(); long long swa = 0; for (int i = 0; i < 2 * n; i += 2) { for (int j = i + 1; j < 2 * n; j++) { if (abs(v[j]) == abs(v[i])) { for (int k = j; k > i + 1; k--) swap(v[k], v[k - 1]); swa += (j - 1 - i); if (v[i + 1] < 0) { swap(v[i], v[i + 1]); swa++; } break; } } } return swa; }
#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...