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

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

I recently tried solving 279-C Problem, but i got WA in test case 8. Here was my approach :

  1. My first for loop finds the triplets (L, M, R) where m is the middle point where the sequence changes from non decreasing to non increasing. Here I store those m point in a vector (ranges) and use a map to store 'L' and 'R' points.

  2. Then for each query I binary search the 'L' point in the 'ranges' vector and check whether 'L' point of this query in fact fits the left portion of the original range and then perform the check for R using the map of pairs. if(l >= left && l <= mid && r <= right && r >= mid)

Can someone tell me what is wrong in this? My Code Thanks!!

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

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

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

I recently solved this problem using a simple backtracking algorithm. I thought it should give me TLE as the time complexity goes upto O(9^m) where max value of m = 1000, but it gave me AC. Can anyone explain me why?

Problem My Code

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

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

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

Hi! Can someone help me debug my code for this problem 431-C

I think I am making some mistake with the modulo (10^9+7)

Here is my code

Thanks!

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

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