tanishq2507's blog

By tanishq2507, history, 5 months ago, In English

https://codeforces.com/gym/104536/problem/F

The answer to this is max(d1,d2,ceil(d1/2)+ceil(d2/2)+1) where d1,d2 are diameters of the two trees.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By tanishq2507, history, 7 months ago, In English

Link to the problem...

I have tried this approach.Try to sort the subarray closer to the last index.Shift the window towards lefts if the new element in left is smaller than all the elements in the new window but this approach fails in one case.

Full text and comments »

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

By tanishq2507, history, 8 months ago, In English

This base conversion algorithm has an application in this problem 1811E - Living Sequence.Why does the base conversion work here.What do the remainders signify in the base conversion?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By tanishq2507, history, 8 months ago, In English

Maximum absolute sum of a subarray =Max prefix sum — Min prefix sum(prefix sum includes zero).

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By tanishq2507, history, 10 months ago, In English

I had got this question in Cisco coding round. I would be grateful if anyone could provide an approach or even an hint. Problem statement is quite long ,please bear with me.

Mr McFly has gone k number of Days into the past. He knows the prices of stocks in the stock market and how much profit they are going to generate if invested. In order to generate profit on investing in a stock ,McFly has to wait for one day to generate the profit and subsequently invest in other stock. Also his broker only allows investing in 1 stock per day and holding period is 1 day per stock. To keep things simple, if Marty invests in a stock ,he won't be able to reinvest in that stock.

McFly has an array of price of n stocks ,where price[i] denotes the price of ith stock and an array of profit of size n where profit[i] denotes the profit generated after a day of investing in the ith stock. McFly has an initial funds f and he can use the profit from stocks to invest in other stocks.Help McFly in picking at most k stocks for k days so as to maximize his funds. Any stock can be picked at any time .

Given k days into the past,initial funds f,price array and profit array print the maximum funds at the end if at most k number of stocks are picked for investment intelligently.

Constraints: 1 <= k <= 10^5 0 <= f <= 10^7

Full text and comments »

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