Блог пользователя Sahashoo

Автор Sahashoo, 9 лет назад, По-английски

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.

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

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 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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