Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор memeset, история, 8 лет назад, По-английски

Hi all,

Could someone please look at my code to this problem? Its a simple dfs with an extra iterating variable, but I'm confused as to why it's returning wrong answer. I'm 90% sure that the string processing part of my code is correct, so that leaves the dfs() function that probably has a bug in it.

vector< string > height[] is the array that I use to store the strings that are on a certain level, and I use vector< int > comma to store the position of the commas to make it easier to extract the numbers and the strings. Also, mx is the maximum height of a comment.

Thanks for your time everyone!

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

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

Hey memeset your recursion is fine, the problem is in pow function you use to calculate number of children of string.Its double precision makes calculation incorrect. Here is your AC code -> 23130965

»
8 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can somebody look at my code and tell why it gives memory limit exceeded verdict?

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Try making your array size 500000 or even 250000 because each string will have at least 4 characters: string, number, and 2 commas.