djm-1 / CpTasks

CP problem solving on important topics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CpTasks

CP problems of important topics

  1. if not equal char in map then add an edge with weight=1, else weight=0
  2. check neighbours and apply 0-1 BFS to find path with min 1's
  3. Alternative approach Dijkstra.
  1. for given edge add 0 in x->y direction
  2. add 1 in reverse y->x direction (not given edge)
  3. apply 0-1 BFS to get a directed shortest path from 1 to n.
  1. find minimum time when making p number of parathas is possible
  2. so monotonic seq of F F F F T T ..... find the first true
  3. set max as (p*(p+1)/2) * maximum val in array
  4. use BS with predicate function keeping number of parathas as constraint.
  1. Try traversing from maximum value nodes (multisource BFS)
  2. Count the number of levels until it exhausts
  3. return level-1 (no of edges till deepest node reqd only)
  1. Classic MST
  2. take log of weights and add them
  3. cost+1 will give total number of divisors
  1. Topo sort first

  2. dp[v]= edge u→v exists ∑ ​ dp[u],

  3. dp[1]=1

About

CP problem solving on important topics


Languages

Language:C++ 100.0%