vsanjay_nitdgp's blog

By vsanjay_nitdgp, history, 9 years ago, In English

sir/mam, i solved this problem

https://www.codechef.com/problems/DIRTBYTE

this is my solution,,, http://ideone.com/dt6lxi

but i dont know why am i getting TLE.

couls anyone pls help me to get AC..

thank you.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
9 years ago, # |
Rev. 6   Vote: I like it 0 Vote: I do not like it

Your time complexity is O(20 * 220 * gcdtime), that one definitely doesn't fit into 1 sec. Just optimize it to O(gcdtime * 220). dp[mask] — lcm of all numbers in mask. , where bit is some one bit in mask.