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

Автор learner_cf, история, 9 лет назад, По-английски

Why down vote ? Please dont down vote if you dont want to help. Is there any problem in asking for help on CF ?

Please provide hint to solve LineMSTDiv2. I looked into code of some participants but could not understand. I also posted same on topcoder's forum but it seams forum is inactive.TC forum linkk

Problem Link on Top Coder

Given is an N.

A complete graph is a graph in which each pair of vertices is connected by exactly one undirected edge.

A graph is called beautiful if:

It is a complete graph on N vertices. Each edge has an associated cost, and each of these costs is either 1 or 2. Hence, there are exactly 2^(N*(N-1)/2) different beautiful graphs. The minimum spanning tree (MST) of a beautiful graph is its subgraph with the following properties:

The subgraph contains all N vertices. The subgraph is connected. (I.e., it is possible to get from any vertex to any other vertex using only edges that belong to the subgraph.) The total cost of edges in the subgraph is as small as possible. A single beautiful graph can have multiple MSTs. (Each of these MSTs will contain a different set of edges, but they will have the same total cost.) An MST is called a line if the degree of each of its vertices is at most 2. Hibiki likes MSTs. She also likes lines. For each beautiful graph G, let f(G) be the number of its MSTs that are lines. (Note that for some beautiful graphs it may be the case that f(G)=0.)

Let X be the sum of the values f(G) over all beautiful graphs G. Please calculate X for her. As X can be very large, compute and return the value (X modulo 1,000,000,007).

Definition Class: LineMSTDiv2 Method: count Parameters: int Returns: int Method signature: int count(int N) (be sure your method is public) Limits Time limit (s): 2.000 Memory limit (MB): 256 Constraints - N will be between 2 and 16, inclusive. Examples 0) 3 Returns: 15 Beautiful graphs are complete graphs on 3 vertices in which each edge has cost either 1 or 2. There are 8 such graphs. Some of these graphs have more than one MST. For example, the graph in which each edge has cost 1 has three different MSTs. In this case, each of those three MSTs is a line, so we count each of them. 1) 2 Returns: 2 There are only 2 beautiful graphs. The value of f is 1 for both graphs, so the answer is 2. 2) 16 Returns: 682141922 Don't forget to take modulo.

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

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

Автор learner_cf, 10 лет назад, По-английски

Read full story here Your text to link here...

You given a undirected weighted graph. You have to select non overlapping edges(No two edges share same vertices) such that weight of selected edges is maximised.

Number of vertices < 200.

Input 7 9 (vertices, edges) 1 2 1 (from, to, weight) 1 4 1 1 6 1 3 2 3 3 4 9 3 6 1 5 2 3 5 4 3 5 6 1

Output 13 by taking edges (1-6) 1 + (3-4) 9 + (5-2) 3 = 13

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

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

Автор learner_cf, 10 лет назад, По-английски

Problem: We are given N boxes in a row. We have to place minimum balls in boxes such that each M consecutive boxes have at least K balls. Find the number of ways of placing balls in boxes. Given N, M, K. 1<=K<=M<=50 M<=N<=10^9 If N = 3, M = 2, K = 1 Ans : 1 If N = 6, M = 3, K = 2 Ans: 6 What is the state of DP ?

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

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

Автор learner_cf, 10 лет назад, По-английски

We are given number of bins N and an integer K. We have to pack numbers in bins such than product of all numbers in bins is equal to K and sum of numbers in bin is minimum ? Limits: N <=1000, K <=10^9

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

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