| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1400918 | jeid12 | Arranging Shoes (IOI19_shoes) | C++20 | 1096 ms | 1960 KiB |
#include <bits/stdc++.h>
using namespace std;
long long count_swaps(vector<int> s)
{
int m=s.size();
vector<bool> used(m,false);
long long ans=0;
for(int step=0; step<m/2; step++)
{
int l=0;
// find first unused shoe
while(used[l])
l++;
int r=l+1;
// find matching shoe
while(s[r]!=-s[l] || used[r])
r++;
// count unused shoes between them
for(int i=l+1;i<r;i++)
{
if(!used[i])
ans++;
}
// if right shoe comes first
if(s[l]>0)
ans++;
used[l]=true;
used[r]=true;
}
return ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
