| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1343716 | ElyesChaabouni | Arranging Shoes (IOI19_shoes) | C++20 | 0 ms | 344 KiB |
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
long long count_swaps(std::vector<int>v)
{
int n=v.size();
ll swaps=0;
map<int,bool>used;
for(int i=0;i<n;i++)
{
if(v[i]<0)
{
int j=0;
for(int k=j;k<n;k++)
{
if(v[k]==-v[i]&&!used[k])
{
j=k;
break;
}
}
if(j>i)
{
used[j]=true;
for(int h=j;h>i+1;h--)
{
swap(v[h],v[h-1]);
swaps++;
}
}
else
{
for(int h=j;h<i;h++)
{
swap(v[h],v[h+1]);
swaps++;
}
}
}
}
return swaps;
}
| # | 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... | ||||
