Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1491 | Codeforces Global Round 13 | FINISHED | False | 10800 | 122660663 | Feb. 28, 2021, 1:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 87 ) | I | Ruler Of The Zoo | PROGRAMMING | brute force |
B'After realizing that Zookeeper is just a duck, the animals have overthrown Zookeeper. They now have to decide a new ruler among themselves through a fighting tournament of the following format: Initially, animal 0 is king, while everyone else queues up with animal 1 at the front of the queue and animal n-1 at the back. The animal at the front of the queue will challenge the king to a fight, and the animal with greater strength will win the fight. The winner will become king, while the loser joins the back of the queue. An animal who wins 3 times consecutively will be crowned ruler for the whole zoo. The strength of each animal depends on how many consecutive fights he won. Animal i has strength A_i with 0 consecutive win, B_i with 1 consecutive win, and C_i with 2 consecutive wins. Initially, everyone has 0 consecutive win. For all animals, A_i > B_i and C_i > B_i . Also, the values of A_i , B_i , C_i are distinct (all 3n values are pairwise different). In other words, an animal who is not a king has strength A_i . A king usually has a strength of B_i or C_i . The exception is on the first turn, the first king (animal 0 ) has strength A_i . Who is the new ruler, and after how many fights? Or will it end up that animals fight forever with no one ending up as ruler? The first line contains one integer n ( 4 <= q n <= q 6000 ) -- number of the animals. i -th of the next n lines contains 3 integers A_i , B_i and C_i ( 0 <= q A_i, B_i, C_i <= q 10^9 ). It is guaranteed that A_i > B_i and C_i > B_i , and that all values of A_i , B_i and C_i are distinct. Output two integers in a single line. The first is the index of the animal that will become ruler, and the second is the number of fights passed until some animal becomes the ruler. If the animals will fig'... |
Codeforces Global Round 13 Editorial |
No solutions yet.