Whoever told me about the 2010noip prisoners, it s better to be more detailed, bring the program, th

Updated on delicacies 2024-04-08
11 answers
  1. Anonymous users2024-02-07

    3 Detention of criminals.

    Type: Data structure - and look up the set (there are many ways to do it, and it can also be thought of as a dichotomous graph + dichotomous answer).

    In previous years, there was really no one in the noip and the collection was checked, which is a very good question for the collection of the collection.

    The idea is to sort all the edges, and then delete each edge once from largest to smallest, and for each deleted edge, the two points connected by the edges need to be divided into two different sets (i.e., the two criminals are separated in different prisons). When we delete an edge, we find that the two points connected on the edge are already in the same class set, then the edge cannot be deleted. That is, the final solution.

  2. Anonymous users2024-02-06

    Bipartite diagram + dichotomous answer.

    It's the right solution.

  3. Anonymous users2024-02-05

    First, the resentment values are sorted from largest to smallest, and each prisoner is set as an independent set, and the antagonistic set is set as an empty set. Combine the two points represented by the resentment value in the following way from large to small: if it belongs to the same set, this value is output, otherwise it is merged with the opposite set of another point in turn, pay attention to the empty set!

    Complexity o(m*log(m)).

    There is no need for a two-way answer!!

    But if you just like dichotomous answers, I suggest you dichotomous answers + bfs dictive graphs. Complexity o(m*log(10 9)).

  4. Anonymous users2024-02-04

    Do it with a two-point answer + and check the set.

    First, the conflicting values given by the question are ranked, and then the interval in which the answer is located can be divided into two.

    The interval is [l,r], and the answer is ans=(l+r)div 2. If the answer is satisfied, the edges that are larger than the conflict value of ans can be divided into two sets, and the conflict values of the people in these two sets are smaller than the value of ans. You can narrow down the upper limit of the answer and divide it in half.

    If the conditions are not met, i.e., the edges that are larger than the ans conflict value can be divided into two sets, and the people in the two sets have a greater conflict value than the ans value, the lower bound can be reduced. When l = r, the answer is ans.

    So how do you determine the conditions? We can do this with a check-and-look-up set.

    With two points on each edge as the parent node, let a relationship be whether they are in the same set or not.

    Each time you select an edge, you determine the relationship between the points of the two edges (including the points with this point as the parent node).

    It can be completely solved by judging by combining and querying the set.

  5. Anonymous users2024-02-03

    Greedy selection, use and check the set to interpret connectivity.

  6. Anonymous users2024-02-02

    Check whether the current node and the parent node are in the same set with a weight of 0 or 1 on the edge of the set.

  7. Anonymous users2024-02-01

    Two ways to do it are to check + greed or dichotomous staining + dichotomous answers.

    In fact, in some ways, neither method is too much of an overclass.

    And check the set as mentioned upstairs And check the set itself is applied to the kruscal in the minimum spanning tree algorithm, which is equivalent to the required content (there should be no school that does not talk about kruscal when talking about the minimum spanning tree...).

    Binary graph matching is not overclass, noip2008 improve group fourth question double-stack sorting is binary graph dyeing + simulation There is a first time and a second time Normal.

    There are also people who think that dyeing a bipartite graph is not a difficult one... noip2009 also has a tarjan shrinkage dp....

  8. Anonymous users2024-01-31

    You can thank you for being greedy, and check the set, sort all the edges first, and then add the greedy ones to the two sets (use the merger to check the set), until there is a contradiction (there is a contradiction between a criminal and two prison people) to output the contradiction value, if it is completely divided into two sets, then output 0, you can ask again.

  9. Anonymous users2024-01-30

    sol:

    With regard to a bipartite graph, if an undirected graph can be divided into two sets of points ab, and for any edge there are x belonging to a, y belonging to b or x belonging to b and y belonging to a, then it is called a bipartite graph, and the others are baidu

    In this problem, it is obvious that the criminals are points, the prison is the point set, and the hatred level between the two criminals is the edges, and this problem hopes that we will cut off some edges in the original graph, so that the remaining graphs are bipartite graphs, and the maximum value of the remaining edges is smaller.

    If we already know that the answer is ans, then we can judge whether ans is feasible in o(n), which is actually to keep the edge of "=ans", and then judge the remaining bipartite graph (baidu by itself).

    Secondly, the answer is monotonic, which means that if ans is a feasible solution, then "=ans must also be feasible", and in layman's terms, the feasibility of ans is fffffttttttttt, then this turning point is the required point, and the two points are fine (self-baidu bipartite answer).

  10. Anonymous users2024-01-29

    Brush up on more questions, especially past questions.

    Find out the type of review that often comes out of the question.

    Nope. Don't think of easy paths.

  11. Anonymous users2024-01-28

    I've been busy for n years, and I finally got it out, and my stack is really bad.

    var temp,n,m,i,j,x,max:longint;

    heap:array[0..10005]of longint;

    procedure down(m,k:longint);

    var tmp,kk:longint;

    begintmp:=heap[k];

    while (k shl 1<=m) dobegin

    kk:=k shl 1;

    if (kk+1<=m)and(heap[kk]>heap[kk+1]) then inc(kk);

    if heap[kk]heap[k]:=heap[kk];

    k:=kk;

    end else break;

    end;heap[k]:=tmp;

    end;begin

    fillchar(heap,sizeof(heap),0);

    readln(n,m);

    for i:=1 to n do

    beginread(x);

    inc(heap[1],x);

    for j:=m shr 1 downto 1 do down(m,j);

    end;max:=0;

    for i:=1 to m do

    if maxwriteln(max);

    end.

Related questions
6 answers2024-04-08

Mrs. Mary went to court for running a red light. The judge stared at her and asked, "Mrs. Mary?" >>>More

18 answers2024-04-08

The starters have not yet been decided.

23-man roster for the Italian team. >>>More

13 answers2024-04-08

Upper body: black top (black T), dark vest, red tie (special), she likes the red X logo. >>>More

6 answers2024-04-08

Plot: Two brothers from a wealthy family take out a banknote with a denomination of one million pounds from the bank to test their theories. One argues that such a bill is worthless to the poor; Another believed that with just such a bill (not cashed), one could live the life of a superior person. >>>More

4 answers2024-04-08

In fact, in the process of learning physics, there are many conclusive theories that are a kind of cross-century masterpieces, and these theories can be said to promote the development of a discipline, especially in physics, there are some courses that can be said to run through the development of physics. This includes the general relativity course, in which you can learn about the different understandings of inertial frames, which can be said to be a very important physical concept knowledge, you may think that general relativity is just a concept, but some of the concepts and perspectives provided by general relativity can be said to create more directions for physics learning. <> >>>More