ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1071. Nikifor 2

Faster Ideas
Posted by georgi_georgiev 13 Aug 2009 05:26
I Solved this problem, by transforming x and y into every system and search for the longest common substring.
But I am interested in another Ideas, better than mine, except brute force.
Re: Faster Ideas
Posted by Klyuchnikov Nikita 30 Aug 2009 15:58
it isn't necessary to search LCS (O(|x|*|y|)), you can check only what y is subsequence of x, so it will be O(|x|+|y|)

Edited by author 30.08.2009 16:00
Re: Faster Ideas
Posted by Astekinane 29 Oct 2011 17:38
Verification of this fact is O(log(max(x,y)))
Re: Faster Ideas
Posted by c_pp 30 Dec 2016 00:39
base = 2..1000 bruteforce,  base > 1000  think a little :))