Paste Search Dynamic
Recent pastes
checkAllConnectedSegments
  1. segments_and_connections= input().split()
  2. n_segments              = int(segments_and_connections[0])
  3. n_connections           = int(segments_and_connections[1])
  4.  
  5.  
  6. def checkAllConnectedSegments(n_segments, n_connections):
  7.     if n_segments != (n_connections+1):
  8.         return print("INCOMPLETO")
  9.    
  10.     segments = [0]*n_segments
  11.    
  12.     for i in range(n_connections):
  13.         connection = input().split()
  14.         connection_segment_1 = int(connection[0])
  15.         connection_segment_2 = int(connection[1])
  16.        
  17.         segments [connection_segment_1 - 1] += 1
  18.         if segments [connection_segment_1 - 1] > 2:
  19.             return print("INCOMPLETO")
  20.            
  21.         segments [connection_segment_2 - 1] += 1
  22.         if segments [connection_segment_2 - 1] > 2:
  23.             return print("INCOMPLETO")
  24.            
  25.     return print("COMPLETO")
  26.  
  27. checkAllConnectedSegments(n_segments, n_connections)
  28.  
Parsed in 0.010 seconds