# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
558122 | imalcok | Arranging Shoes (IOI19_shoes) | C++17 | 1 ms | 304 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 <iostream>
using namespace std;
long long count_swaps(std::vector<int> S){
long long c = 0;
int g[S.size()] = {0};
for (int i = 0; i < S.size(); i++)
{
if (g[i]) continue;
else if (S[i] < 0){
int j = i+1;
while (S[j] != (-1)*S[i] || g[j]) j++;
g[j] = 1;
c += (long long)(j-i-1);
}
else
{
int j = i+1;
while(S[j] != (-1)*S[i] || g[j]) j++;
g[j] = 1;
c += (long long)(j-i);
}
}
return c;
}
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... |