# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431865 | JUANDI321 | Arranging Shoes (IOI19_shoes) | C++17 | 1022 ms | 3948 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 <vector>
#include <deque>
#include <iostream>
using namespace std;
long long count_swaps(vector<int> s)
{
long long count = 0;
deque<int> sc(s.size());
for(int i = 0; i<s.size(); i++)sc[i] = s[i];
while(!sc.empty())
{
int x = sc.front();
sc.pop_front();
int pos = 0;
for(int i = 0; i<sc.size(); i++)
{
if(sc[i] == x*-1)
{
pos = i;
break;
}
}
count+=pos+1;
if(x < 0)count--;
sc.erase(sc.begin()+pos);
}
return count;
}
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... |