ad_red's blog

By ad_red, history, 16 months ago, In English

I have a modification of the Josephus problem (e.g., we have $$$n$$$ people in a circle, and we kick each $$$k$$$-th out till we have only one, tell which number he has), but I have to output the order in which the last $$$4$$$ people (I guess it generalises to $$$p$$$ people in the end) are kicked out.

The constraints are $$$10^7$$$ for both $$$n$$$ and $$$k$$$, which makes it almost impossible to pass a naive solution ($$$O(n \log{k})$$$) without optimisation magic. All Josephus problem approaches which are known to me seem to be ungeneralisable to get the order of elements which are removed from the circle.

Feel free to comment if you have any ideas! The unfolding from the last state (1 element left) doesn't seem to be a very promising strategy, but I might have missed some important observations.

Full text and comments »

  • Vote: I like it
  • +17
  • Vote: I do not like it

By ad_red, history, 18 months ago, In English

The problems available on the EDU section, and in the ITMO course in particular, are very helpful in learning the basics. It would be awesome to be able to add them to private mashups for school trainings and other stuff. I couldn't find a way to copy any of the EDU problems to my mashup contests.

If this is impossible without big changes, is there a way to reduce the amount of work required to have those problems in a mashup? The tests can be opened after the problem is solved by the user, which (at least) simplifies the test writing problem. Otherwise it becomes a massive pain to use the basic, almost theoretical problems because the archive problems are more advanced and sometimes don't suit the level of the audience.

What do you think? If there is a way to get those basic problems (especially from Binary search and Segment tree sections) or I miss something important please comment.

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it