Submission #143760

#TimeUsernameProblemLanguageResultExecution timeMemory
143760dacin21Arranging Shoes (IOI19_shoes)C++17
15 / 100
31 ms1928 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; using ll = int64_t; long long count_swaps(std::vector<int> v) { const int n = v.size()/2; ll ret = 0; ret = n * (ll)(n-1)/2; /*for(int i=0;i<n;++i){ const int l = 2*i; int a = l; while(v[a] > 0) ++a; ret += a-l; rotate(v.begin()+l, v.begin()+a, v.begin()+a+1); assert(v[l] < 0); int b = l+1; while(v[b] != -v[l]) ++b; ret+=b-l-1; rotate(v.begin()+l+1, v.begin()+b, v.begin()+b+1); assert(v[l+1] == -v[l]); }*/ return ret; }
#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...