Why do i have RUNTIME_ERROR 722C???

Revision en1, by CF2_kafuma, 2016-10-15 21:50:22

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 ];

Tags dsu, python 2

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English CF2_kafuma 2016-10-16 08:33:49 1190
en2 English CF2_kafuma 2016-10-15 21:52:03 22
en1 English CF2_kafuma 2016-10-15 21:50:22 1556 Initial revision (published)