# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
751335 | kusmetliq | Arranging Shoes (IOI19_shoes) | C++14 | 1084 ms | 3916 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 "shoes.h"
#include<bits/stdc++.h>
using namespace std;
long long count_swaps(vector<int> s) {
deque<int>a;for(int i:s)a.push_back(i);
long long ans=0;
while(a.size()>0) {
int ind=-1;
for(int i=0;i<a.size();i++) {
if(a[i]<0) {
ind=i;
break;
}
}
ans+=ind;
int v=-a[ind];
a.erase(a.begin()+ind);
int c=find(a.begin(),a.end(),v)-a.begin();
ans+=c;
a.erase(a.begin()+c);
}
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... |