rickgrimes07's blog

By rickgrimes07, history, 13 months ago, In English

Given an array of positive integers , you have to perform Q queries . Each query can be of two types , 1 L X 0 , set arr[L]=X;

and other type be 2 L R X , find index p such that arr[p]<=X and if there is no such p , print -1.

arr size and Q are of order 1e5

Full text and comments »

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

By rickgrimes07, history, 13 months ago, In English

https://cses.fi/problemset/task/1139

https://cses.fi/paste/cdb7092742c2c314be200e/

DFS , TC: O(n)

m=2*n

Segment tree , build and query , O(mlogmlogm) , roughly

Full text and comments »

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