Comments

.

I meant complexity wise , if you're talking constants 2*root(n)

+1

There are atmost root(n) divisors of n. For node 1 calculate all it's divisors and run a dfs with a divisor assumed as answer and see how far you can go with only change (a number to 0 in path) and maintaining gcd equal to that number. Do it for all the divisors. That's a n root(n) solution. One more case when you change node 1 to 0 can be handled by just changing it and running dfs with no further number change and taking gcd of all the nodes in path. Not to mention every time you reach a node ans[node]=max(ans[node],current). Put all answers to 1 by default.

0

normal segtree with DnQ , knuth or something else? Please explain a bit? Thanks!

That is exactly what i was thinking( checking for every b) and i knew it was gonna TLE so i didn't code it cus it was obv k*n*n :C

0

Thank you!

0

Can you share your implementation? I did exactly as you said and i get all the test cases right but i still get last 2 test cases somehow wrong and i tried everything including overflow , double hashes still no luck. @satyaki3794

1 0 0 100000 100000 0 0 1 0 Output 0.0000000 Answer -1

Everyone seems to fail on 24

It was great and helped me a lot,, thanks man

-8

Did you find any solution for that?

On HosseinYousefi2-SAT Tutorial, 9 years ago
0

this ofcourse will happen very rarely, but if you assign 0 and 1's randomly it would mean hours of debugging if something like this comes up.

Can you explain a bit? Thanks

thanks!!

can someone show me the code for the first question i think i was getting tle for no apparent reason.thanks