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

Автор joseph_goldberg, история, 3 года назад, По-английски

I know 2-D segment tree and 2-D Fenwick tree and I have used them. I was trying to solve the problem 869E - The Untended Antiquity . In this question, I understood the whole core logic of 2-D Fenwick tree but I couldn't understand why we use random instead of that if I use count=0 like assigning count for one boundary then I increment the count and assign that count to another boundary and so on. I tried this approach and I got the wrong answer on Test Case 9 but it was too large that I couldn't see what the test case was. So, if you can tell me why we use random numbers it will be helpful.

Полный текст и комментарии »

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

Автор joseph_goldberg, история, 3 года назад, По-английски

I was trying to understand the editorial explanation of the problem 1067A - Array Without Local Maximums . But after spending the whole day I still couldn't understand the editorial and neither other DP solution. If anyone can please explain in simple language how are transitions and what each state represents it will be really helpful.

Полный текст и комментарии »

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

Автор joseph_goldberg, 3 года назад, По-английски

Can someone please help me in understanding part of the code? Submission 34448654 Problem 916E - Jamie and Tree

Author of the code William Lin

Part of the code I don't understand I think it is something related to storing the ancestors on different levels but I can't understand properly any help will be great.

for(int i=1; i<=lg2(n); ++i)
		for(int j=0; j<n; ++j)
			anct[i][j]=anct[i-1][j]==-1?-1:anct[i-1][anct[i-1][j]];

I have seen other solutions they did the same thing but I couldn't understand.

Update: I understood from Errichto Channel Link

Полный текст и комментарии »

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