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

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

You are given the hierarchy of a company, represented by a directed tree of N nodes  where N is the number of employees. Each employee has only one direct manager and possibly many indirect managers. Each employee can manage many employees directly and indirectly.

Each employee has a skill level A[x] and an expertise level.

The expertise level of an employee equals the count of employees y such that:

-> A[y] > A[x] -> The employee x manages the employee y (directly or indirectly).

A set of employees is a beautiful set if, none of the employees in the set manages the others directly or indirectly. The expertise of the set equals, the sum of the expertise levels for all the employees in the set.

Find the maximum expertise of a beautiful set with size at most K.

Notes: A tree is an undirected graph in which any two vertices are connected by exactly one path. A directed tree is a directed acyclic graph (DAG) whose underlying undirected graph is a tree.

The size of a set is the number of employees in the set.

Constraints: 1<=N<=10^5 1<=K<=100 1<=A[i]<=10^5 -1<=Parent[i]<=N

Input Format N K A[] Parent[]

Sample: Input 3 1 1 2 3 -1 1 2

Output 2

Input 3 1 1 1 3 -1 1 2

Output 1

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

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

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

Balajiganapathi Hello, I got the mail few days back that for regionals there will be a fees of Rs. 700 to be paid.

Can't we have regionals free because this time it's not onsite competition?

Also, this would help encourage all the students.

Please see, if anything can be done in this regard.

Thank you.

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

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

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

Where is this formula used?

left_tree (data) <= node (data) <= right_tree (data)

Binary tree or BST or AVL Tree or Heap

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

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

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

Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a Maximum weight spanning tree of G can have is. ?

For minimum weight spanning tree answer is 7 but I have to calculate it for maximum weight spanning tree.

How to solve it and what will be the answer.

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

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