Latency always have the last laugh.
Vangelis the Batbear trapped all the members of Joker’s Streetgang in a basement.
Your job as a police officer is to transport all gang members to Blackgate Penitentiary.
To facilitate the transport, you should form a row such that the heights of the gang members are in non-decreasing order. For each gang member you should find the min and the max position where they can be in a valid sorted row and produce a roster with this information.
Input will start with a line that contains only one integer
M, the number of crew members that were arrested. On each of the following
M lines there will be a single word
N and an integer
H separated by a space character, where
N is the name and
H is the height of the crew member.
On the output, there will be
G lines. Each line will contain in alphabetical order and space separated the names of the crew members that have the same height, followed by the min and the max position where any member of the specific group can be placed.
Limitations and notes
1 ≤ M ≤ 1000
1 ≤ length(N) ≤ 10
120 ≤ H ≤ 250
Names are only composed of characters of the Latin alphabet.
Good evening master Wayne.
Joker and his gang attended Black Hat USA 2017 where they learned of a new way on how to damage our city!
Specifically, tomorrow night they will try to damage the water pumps of Gotham using bubbles!
The bubbles cause corrosion to the pumps and in a few hours they will damage them with catastrophic results!
To dash Joker’s plan, besides stopping him, you need to make sure that the city network does not contain loops.
If Joker manages to inject bubbles to the network and they enter a loop, they will still cause damage to that area even though you would have already arrested Joker and his gang.
Given the map of the water distribution system, you need to make sure that the map does not contain loops.
On the first line there will be an integer
T, the number of test cases to follow.
For each test case, there will be 2 input lines:
- On the first line of the test case, there will be 2 integers
Vis the number of vertices and
Eis the number of edges.
- On the second line, there will be
Epairs of integers separated by a space character. Each pair shows a two way connection between vector
For each test case you will have to write one line that contains an integer, in the case where there is a loop you will write the number
1 or else you will write the number
Limitations and notes
1 ≤ T ≤ 1000
1 ≤ V ≤ 1000
1 ≤ E ≤ 10000
0 ≤ A,B ≤ V-1
- Random test case generator – batman-bubbles-generator.cpp (compressed) (15 downloads)
To install the
openssh-server, you need to install the
sudo yum install -y openssh-server;
To start the sshd daemon (openssh-server) in the current session:
sudo service sshd start;
To stop the active (if any) sshd daemon in the current session:
sudo service sshd stop;
To configure the sshd daemon to start automatically at boot time:
sudo chkconfig sshd --add; sudo chkconfig sshd on --level 2,3,4,5;
To configure the sshd daemon to stop automatic initialization at boot time:
sudo chkconfig sshd off; sudo chkconfig sshd --del;