# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575408 | web | Arranging Shoes (IOI19_shoes) | C++17 | 19 ms | 2500 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>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
long long count_swaps(std::vector<int> s) {
int n = s.size()/2;
// vector<pair<int, bool>>shoes(2*n);
vector<int> posNegs;
for(int i =0 ; i<2*n; ++i)
{
// shoes[i] = {abs(s[i]), s[i] < 0};
if(s[i] < 0)
posNegs.push_back(i);
}
long long numSwaps = 0;
/*
//sort(shoes.begin(), shoes.end());
int currShoe = 0;
while(currShoe < 2*n)
{
int findShoe = shoes[currShoe].first;
int findShoeSign = !(shoes[currShoe].second);
pair<int, bool> lastEl = {findShoe, findShoeSign};
for(int i = 1; i<(2*n-currShoe); ++i)
{
swap(lastEl, shoes[currShoe+ i]);
if(lastEl.first == findShoe && lastEl.second == findShoeSign)
{
//found
break;
}
numSwaps++;
}
if(shoes[currShoe].second == 0)
{
numSwaps++;
swap(shoes[currShoe], shoes[currShoe+1]);
}
currShoe+=2;
}*/
return (n*(n-1))/2;
}
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... |