Hello guys, Ive been stumped on this problem for a few days now. At first I thought I could do this with a bfs or dfs with the only pruning being that I don't do opposite operations in consecutive moves. Hence a 1 can only be followed by a 1,2 or 4 . Hence apart from the first move where there are 4...
Hello guys. If any of the 'Accepted' guys could give me their output for : 13 AMERFAZALRAHMAN MIRANDA GTAVICECITY GRANDTHEFTAUTO INTRODUCTIONTOALGORITHMSTHOMASCORMENCHARLESRONALDCLIFFORD LOWPRICEEDITION THECLASSICWORK T MSNMESSENGER AAAAAAAA AAAA AAABBB BBBAAA 174 10 35 40 637196 61 22 1 50 255 15 1...
Thanks Adrian I incorporated that slick piece of info into my code and now I'm getting 0.006 with 64 mem usage. Then I changed my cout into printf and it further improved to 0.002 !! I guess I can improve that further if I improve my method of finding primes upto 1000 but 0.002 is good enough :) Tha...
I've gotten "Accepted" with time of 0.6 s and 8864 of memory.. I thought this would be pretty good. When I open the ranklist, the first page is full of 0.00 guys !! How did you guys do it. My Algo : - Find all the primes upto 1000000 - For each number upto 1000000, find it's largest prime ...
Thanks Cho! I got AC. I had made a couple of silly mistakes.
My AC has a time for 0.9 seconds.. I was wondering what yours was because I can see some people have done this problem in 0.02 seconds ! If yours is also low, can you please give me some hints on your algorithm?
I'm getting WA .. I've tested the test cases in another thread and they all work. Can you give you your output for these cases and if mine are all correct can you please suggest some other test cases. Thanks. Input: 7 4500 3 3 4500 4999 9999 2 9999 2 2 5 5 10 10 Output: Case 1: Impossible to divide ...
My evidently pathetic algorithm that takes about 5 seconds on certain cases is as follows : Let the input number be N 1) If N is odd , N=N+1 2) Set x = 2 and counter=1 While(x!=1) { x = (x<<1)%(n-1) counter++ } This is based on the observation that if you label the cards from 0 to n-1, then every ca...
And here I am doing it in such a complex way. I got every single valid sequence and then found all the combinations/permutations (never knew the difference ) of them...