Advertisement
deadwing97

Untitled

Sep 5th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. Suppose you are in front of N machines, each machine has fixed number of balls (each ball of certain color). You see the balls in each machine.
  2.  
  3. Your goal is to get 2 balls of the same color. When you press the button of one certain machine, the machine would drop out a random ball and you take this ball.
  4.  
  5. Find minimum number of pressings X such that there's one sequence of machine presses of length X that would get you 2 similar balls no matter what you get in each draw.
  6.  
  7. sample:
  8.  
  9. 4 machines
  10.  
  11. 3 balls 1 2 3
  12.  
  13. 1 ball 1
  14.  
  15. 1 ball 2
  16.  
  17. 1 ball 3
  18.  
  19. Answer 2:
  20.  
  21. first press first machine, depending on what it gives you press one of the reamining
  22.  
  23. sample2:
  24.  
  25. 2 machines
  26.  
  27. 2 balls 1 2
  28.  
  29. 2 balls 1 2
  30.  
  31. answer 3:
  32.  
  33. If you decide to press only 2 buttons, no matter what machines you press there's always a probability to get {1,2}
  34.  
  35. so you need a third click to ensure
  36.  
  37.  
  38. ----------------------------------------------------------------------------------
  39.  
  40.  
  41.  
  42. You have N words of same length L
  43.  
  44. they are written on top of each other in a grid format
  45.  
  46. abcd
  47.  
  48. bcde
  49.  
  50. efgh
  51.  
  52. find a permutation of columns such that when you apply it all words are sorted in lexicographical order or state that it's impossible. in case of multiplle solutions output least lexico permutation.
  53.  
  54. N*L <= 10^6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement