Блог пользователя wrong_an_swer

Автор wrong_an_swer, история, 4 года назад, По-английски

This Question logic implemenation is easy , but as test case is very large so it is not able to pass in 2 seconds even after Meomizing the answer.

Images :

https://imgur.com/gallery/anvdek1

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wrong_an_swer (previous revision, new revision, compare).

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This problem can not be solved.

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wrong_an_swer (previous revision, new revision, compare).

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by wrong_an_swer (previous revision, new revision, compare).

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

There are up to 2 parts of each sequence of events 1) ball is passed around without entering a cycle 2) eventually the ball will enter into a cycle for large number of passes. Proof: if there are more passes that people, then some person must receive the ball more than once by pigeon hole principle.

You need to handle both cases elegantly. The cycle part needs to be handled with modular arithmetics.