# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
428118 | Hazem | Arranging Shoes (IOI19_shoes) | C++14 | 1080 ms | 1980 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>
#define LL long long
using namespace std;
long long count_swaps(std::vector<int> s) {
LL n = s.size()/2,ans = 0;
int cnt = 0;
for(int i=0;i<n*2;i++){
if(s[i]<0){
for(int j=i;j>cnt*2;j--)
swap(s[j],s[j-1]),ans++;
int idx = find(s.begin()+cnt*2,s.end(),-s[cnt*2])-s.begin();
assert(idx!=s.size());
for(int j = idx;j>cnt*2+1;j--)
swap(s[j],s[j-1]),ans++;
cnt++;
}
}
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... |