Given a length l, find the angle and dimensions of the 4 sided quadrilateral formed having maximum area (this quadrilateral is not a square)?

# | User | Rating |
---|---|---|

1 | tourist | 3434 |

2 | Petr | 3353 |

3 | OO0OOO00O0OOO0O0…O | 3314 |

4 | fateice | 3306 |

5 | Um_nik | 3286 |

6 | Syloviaely | 3274 |

7 | dotorya | 3145 |

8 | LHiC | 3114 |

9 | Radewoosh | 3098 |

10 | mnbvmar | 3096 |

# | User | Contrib. |
---|---|---|

1 | tourist | 178 |

2 | rng_58 | 166 |

3 | Petr | 156 |

4 | csacademy | 155 |

5 | Swistakk | 149 |

5 | lewin | 149 |

7 | Um_nik | 142 |

8 | Errichto | 141 |

9 | matthew99 | 138 |

10 | Vovuh | 136 |

10 | ko_osaga | 136 |

10 | PikMike | 136 |

Can someone provide me segment tree implementation of:

Range update : Add x to range

Finding frequency of a constant in range

I know of solution in sqrt decomposition exist, but I wanted in terms of segment tree (maybe lazy propagation or policy based data structures)?

Hi, I need to form test cases for a program having 2 parameters, but it should be blackbox and must find all possible exceptions (such as division by 0, etc). Could someone provide me some resource or algo?

x/(x+y-5)

(x, y) = (1, 4) is one test case generated

Provide me way to generate test cases (obviously it should be less).

Can anybody provide solution to this?

If I want 1/i for 1<=i<=5000000, i.e. inv[i]

```
inv[1] = 1;
for (int i=2; i<p; ++i)
inv[i] = (p - (p/i) * inv[p%i] % p) % p;
```

I used this but it times out. So I wanted a way for this.

Besides that, if I use fact[i-1]*invfact[i] : would that solve? It is not giving me correct answer so plz tell me what is wrong over here?

For serialising and deserialising a binary tree( or a n-ary tree ) only preorder traversal with # for Null is used in the given Link but I think both inorder and preorder are required to construct tree.

Please tell me what is that I am missing?

Q1).

Given isosceles right angled triangle, find the radius of the smaller circle.

Q2).

Given a rectangle ABCD with length l and breadth b, it is folded along diagonal BD. i.e. A is joined to C. Find the length of the line segment EF

You have a set of N objects. Each of these objects have certain properties associated with them. A property is represented by a (key, value) pair. For example, assume you have the following two objects.

Tower: { (height, 100), (weight, 50), (xposition, 25), (yposition, 36) }

Tree: { (area, 100), (noofleaves, 500), (height, 25), (yposition, 36) }

Each object you have, will have at most 4 properties. An object will have at least 1 property. Note, from the two objects above, that it is not necessary for key in the properties to be same for all the objects. Also, it is not necessary for the key to be different. Now, given N such objects, you wish to answer M queries. Each query is represented by a set of properties (again, at most 4 properties, and at least 1 property). The answer for the query is the number of objects in the set, that have all the given properties. Two properties are considered equal iff both the key and the value match. For example, if you have the above two objects, then the answer for the following queries is

Query: { (height, 100), (yposition, 36) }

Answer: 1 // matches Tower, but not Tree

Query: { (yposition, 36) }

Answer: 2 // matches both Tower and Tree

Query: { (height, 100), (noofleaves, 500) }

Answer: 0 // neither Tower, not Tree satisfy both properties

Input:

The first line of input contains N and M. This is followed by the description of the N objects. The description of the i-th object will start by a number k, which is the number of properties associated with the object. The next k lines contain two space separated strings – the property key and the property value. Note that the property value is not necessarily an integer (although this is so for the example above). This is followed by the description of M queries. The format of a query will be exactly same to that of the objects. Check the Sample Input for clarification. One test file will contain only one test case. A single test case may contain several queries.

Output:

Print M lines. Each line must be the answer of the respective query.

Constraints:

1 <= N <= 10000

1 <= M <= 100000

1 <= k <= 4

Sample Input 2 3

4

height 100a

weight 50b

xposition 25a

yposition 36b

4

area 100a

noofleaves 500

height 25

yposition 36b

3

weight 80

xposition 25a

yposition 36b

1

yposition 36b

2

xposition 25a

yposition 36b

Sample Output:

0

2

1

```
Given n boxes of different weights and m machines of different weight carrying capacity. Find the minimum time required to move all boxes. Each machine take 1 minute to carry one time.
```

Can somebody suggest a approach.

Link : In the given link it says if the word is in min heap, then also you can increase the count but it is slightly confusing. Can somebody suggest an approach for this or another way for updation if the word already exists in min_heap.

I am sharing image of question as link is not working:

Please someone help me in his question.

I had a doubt how this solution clears large dataset of Kickstart Round B as it is (N*M*K) which is dp entries and each entry is computed in approx (N*M). Lastly T test cases too and each of the variable, that is, N, M, K, T is in range 1,..,100.

Am I making an error in understanding or test cases were weak as I tried locally on large dataset and it worked within 2 mins.

You are given a string of ‘n’ characters where n is even. The string only consist of 6 type of characters: (){}[]. The task is to form a well formed expression. A well formed expression consist of proper nesting of braces and their is no priority between the braces like [ > } > ). You can edit any bracket and change it to remaining types for accomplishing the task.

```
Example
A. "(){}" is valid
B. "({[]})” is valid
C. “((})” is invalid
```

You are given a number of points on the XY-plane, [(x0,y0),(x1,y1),(x2,y2),...]. A point (xi,yi) is dominant to another point (xj,yj) iff xi>xj and yi>yj. Calculate all pairs of points such that one dominates the other.

**A time complexity less then O(n*n) was required.**

In a city, the rents of apartments change every month according to the demand. If there are x apartments in the city, all the rents for 12 months are given for each apartment and also x one time **relocation prices** are given(Applies when you move from one apartment to other in the first month).

If a person comes to this city and wants to rent an apartment, optimize the rental cost for whole year by generating a month wise plan on where he must stay each month?

`design an efficient algorithm to find the k nearest restaurants to these customers.`

**Problem:** Write a method that, given a digit 'd' and number of its occurences 'k', returns a range which has that many occurrences of d. More precisely, return a lower and upper bound of this number N.

input: d=4, k=1

output {4, 13}

Range: 4-14

input: d=4, k=0

output {1, 3} Range: 1-3

Can anybody help me in this?

Hi,

**Given a max-heap represented as an array, return the kth largest element without modifying the heap.** Pleaae provide an algorithm which is most optimised. There are few answers on net but I guess most are following a particular structure of heap, so I want a correct answer.

**Given a 2D board and a word, find if the word exists in the grid.**

The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The cell itself does not count as an adjacent cell. The same letter cell may be used more than once.

1). Grid: ab

Word = abab

return 0

2). Grid

[ ["ABCE"],

["SFCS"],

["ADEE"] ]

Word = "ABCCED"

return 1

*I cannot get a proper solution to this which handle all cases so if someone can help, it would be very helpful?*

Given 'n' circles (each defined by center and radius) Write an algorithm to detect if given circles intersect with any other circles in the same plane

Better than O(n^2) complexity

Giving a string and an string dictionary, find the longest string in dictionary which can formed by deleting some characters of the giving string.

Example:

S = abpcplea,

Dict = {ale, apple, monkey, plea},

the return "apple"

Can somebody provide trie solution( O(N*K) ), N: length of string, K: length of longest word?

In today's kickstart problem, https://codejam.withgoogle.com/codejam/contest/6304486/dashboard#s=p1

I am getting wrong answer on big input but smaller input works fine and gives correct answer. Here is my code: https://ideone.com/7Ffer4

I tried with bigger input and answer is coming mostly as 0.

I can't find the error. Can someone tell the error and how to correct it.

Hi, I wanted to solve this question in O(N) but couldn't think of it. I did it in O(N logN ) using priority queue but can somebody provide me O(N) solution.

https://postimg.org/image/c31iexg13/

The link of question is not opening now, so I have shared the pic of question.

Can anybodyt help to find complexity oof this algo: T(n) = n^ (1/3) T( sqrt( n) ) + 2n

I solved it and found it be O(n) but is it correct? Please confirm.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/21/2018 20:55:09 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|