Sahashoo's blog

By Sahashoo, 9 years ago, In English

Submission Link

Hi,

I was thinking about 442-div 2-D problem and I come up with noting except a bad solution.

as I say it was a bad solution because it run from O(n*m*k) thus it should get TLE but I got an AC!?

can anybody say just why?????

sorry for bad Eng.

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

»
9 years ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Your solution isn't O(nmk) due to if(...||mrk[x][y][i])break;. Try to construct a worse case scenario for simple map with m=1 and you'l see that factor k doesn't apply.

»
9 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

You can't enter in vertex more than 4 times, so your solution is O(nm).