# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
899358 | SuPythony | Arranging Shoes (IOI19_shoes) | C++17 | 1056 ms | 3164 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count_swaps(vector<int> S) {
ll ans=0;
for (int i=0; i<S.size(); i+=2) {
ll val=S[i];
auto f=find(S.begin()+i+1, S.end(), -val);
ll k=f-S.begin()-i;
if (S[i]<=0) ans+=(k-1);
else ans+=k;
S.erase(f);
S.insert(S.begin()+i+1, 1);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |