Submission #896174

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8961742024-01-01 00:15:51svazArranging Shoes (IOI19_shoes)C++14
50 / 100
1098 ms142552 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...