# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303720 | noob_c0de | Arranging Shoes (IOI19_shoes) | C++17 | 1 ms | 256 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;
#define ar array
int count_swaps(vector<int> a)
{
vector<ar<int,2> > dg,am;
for (int i=0;i<a.size();i++)
{
if (a[i]>0) dg.push_back({a[i],i});
else am.push_back({-a[i],i});
}
sort(dg.begin(),dg.end());
sort(am.begin(),am.end());
int ans=0;
for (int i=0;i<dg.size();i++)
{
if (dg[i][1]>am[i][1]) ans+=dg[i][1]-am[i][1]-1;
else ans+=am[i][1]-dg[i][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... |