# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601670 | chirathnirodha | Arranging Shoes (IOI19_shoes) | C++17 | 1080 ms | 1876 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;
#define MP make_pair
#define PB push_back
long long count_swaps(vector<int> s){
int ans=0;
int n=s.size()/2;
for(int i=0;i<2*n;i+=2){
if(s[i]<0 && s[i]==-s[i+1])continue;
int pos;
for(int j=i+1;j<2*n;j++){
if(s[i]==-s[j]){pos=j;break;}
}
for(int j=pos;j>i+1;j--){
swap(s[j],s[j-1]);
ans++;
}
if(s[i]<0)continue;
swap(s[i],s[i+1]);
ans++;
}
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... |