that's my code , and i can't understand why i have RUNTime_Error?? can someone explain me??
limite = input();
Arrays = map( int, raw_input().split( ) );
Orden = map( int, raw_input().split( ) );
MaxValue = 0;
Visitado = '0 '*100001;
DisjointSet = { key : key for key in range( 1 , limite + 1 ) }
DisjointValueSet = { key : 0 for key in range( 1 , limite + 1 ) }
Visitado = Visitado.split();
def FindSetDSU( posicion ):
if posicion == DisjointSet[ posicion ]:
return posicion;
else:
DisjointSet[ posicion ] = FindSetDSU( DisjointSet[ posicion ] );
return DisjointSet[ posicion ];
def NumberMax(posicion):
Visitado[posicion] = '1'; # warning
Rpta = Arrays[ posicion — 1 ];
Pos_A = FindSetDSU( posicion );
if posicion > 1 and Visitado[posicion - 1] == '1':
Pos_B = FindSetDSU(posicion - 1);
DisjointValueSet[ Pos_A ] += DisjointValueSet[ Pos_B ];
DisjointSet[ Pos_B ] = Pos_A;
if posicion < len(Arrays) and Visitado[posicion + 1] == '1':
Pos_B = FindSetDSU( posicion + 1 );
DisjointValueSet[Pos_A] += DisjointValueSet[Pos_B];
DisjointSet[Pos_B] = Pos_A;
DisjointValueSet[ Pos_A ] += Arrays[ Pos_A - 1 ];
return DisjointValueSet[ Pos_A ];
Elementos = [ 0 ];
for x in range( limite -1 , 0 , -1 ):
MaxValue = max( NumberMax( Orden[ x ] ) , MaxValue )
Elementos.append( MaxValue )
Elementos.reverse();
for x in range( 0, limite ):
print Elementos[ x ];