1. 程式人生 > >HDU 1950 Bridging signals(樹狀陣列)

HDU 1950 Bridging signals(樹狀陣列)

On the first line of the input, there is a single positive integer n, telling the number of test scenarios to follow. Each test scenario begins with a line containing a single positive integer p<40000, the number of ports on the two functional blocks. Then follow p lines, describing the signal mapping: On the i:th line is the port number of the block on the right side which should be connected to the i:th port of the block on the left side.