# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
896174 | svaz | Arranging Shoes (IOI19_shoes) | C++14 | 1098 ms | 142552 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<deque>
#include<map>
using namespace std;
long long count_swaps(std::vector<int> S){
map < int , pair < deque<pair<int,int> >,deque<pair<int,int> > > > alm;
int tam=S.size();
vector<bool> visitados(tam,false);
for(int i=0;i<tam;i++)
{
int absol=abs(S[i]);
if(S[i]<0) ((alm[absol]).first).push_back(make_pair(i,i)); /// los izquierdos al primero
else ((alm[absol]).second).push_back(make_pair(i,i));/// los derechos al segundo
}
// cout<<"siii"<<endl;
int ans=0,empares=0;
for(int i=0;i<tam;i++){
// cout<<"vuelta "<<i+1<<endl;
int p_izq,p_der,dif,p_mov;
if(! visitados[i]){///si no esta emparejado
empares++;
// cout<<"no esta emparejado"<<endl;
int absol=abs(S[i]);
// cout<<"el tipo de zapato es el "<<absol<<endl;
p_izq=(((alm[absol]).first).front()).second;
// cout<<"el zapato izquierdo esta en "<<p_izq<<endl;
p_der=(((alm[absol]).second).front()).second;
// cout<<"el zapato derecho esta en "<<p_der<<endl;
# | 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... |