Write your own exam summary 9.10

Source: Internet
Author: User

September 10

T1 I think the problem is mainly due to the complexity of the time, 70 of the words always feel casually engaged. Look at the puzzle, get full marks, need to make MO team algorithm, the time complexity optimization to O (Nlogn), in short did not learn this, but I was a session of people AC.

T2 40 points good to take, it should be greedy law, a very simple knapsack problem. 100 words, the way to serve, I hope that after learning this later can read Qaq. : "100 points need to use and check the maintenance of the relationship between the equipment, the equipment can not be put together in a set, so it is converted to set knapsack problem." ”

T3 Seniors said 30 points casually, but I got 15. The algorithm is needed to balance the tree, indicating not.

1 . Warrior Tower

(Tower.pas/c/cpp)

"Problem description"

In the Far East, there is a membrane tower, the film King took the Princess, and imprisoned it in the membrane tower on the 21 floor, warriors need to break the tower, rescue the princess.

Now there are n film monsters in front of the warrior, each film monster has a property value AI, the property values of different film monsters as different kinds of membrane monsters, now the Warriors want to know how many different kinds of membrane monsters in the first qi~qj, please help solve.

"Input Format"

Line 1th: 2 integer n,q, respectively, indicating the number of film monsters and the number of queries.

Line 2nd: n integers representing the attribute values for each of the film monsters.

Line 3~q+2:2 integer qi,qj per line.

"Output Format"

A total of Q lines, one integer per line, representing the answer.

"Data Range"

For 70% of data, n≤100,q≤1000;

For 100% of data, n≤3000,q≤200000,1≤a[i]≤1000;

Data Assurance qi≤qj.

2 . Warrior's Backpack

(Bag.pas/c/cpp)

"Problem description"

After arduous hardships, the warrior finally came to the 15th floor, this is a special place-the equipment library.

There are a total of n pieces of equipment, each equipped with a value pi and weight wi, at that time because these equipment is not the elderly, some equipment can not be put together, otherwise it will resonate, release the force of the primitive, the world destroyed. And this resonance has a special recursion, for example, a cannot be put together with B, B can not be put together with C, then a can not be put together with C.

The warrior wants to know the maximum amount of equipment that can be gained within his capacity.

"Input Format"

Line 1th: 3 integers n, m, k,n for the number of equipment, m for the maximum weight of the brave, K indicates that there is k (segmentation) equipment can not put together the relationship.

Next n lines: 2 integers per line, Pi, Wi, each indicating the value and weight of each piece of equipment.

Next K-line: 2 integers A, B per line, indicates that item A is not equipped with item B equipment.

"Output Format"

An integer that represents the maximum value that can be obtained.

"Data Range"

For 40% of data, k=0

For 100% of the data, 0≤n,m,k≤1000,0≤pi≤10000,1≤wi≤10, are integers, A, B are not equal

3 . Warrior film King

(Moking.pas/c/cpp)

"Problem description"

"You're still here!" ”

"Yes, I am coming!" ”

"Membrane film ..."

"The film King ..."

On the top--21 of the membrane tower, a world-class showdown began.

The warrior Lights out his n magic weapon, to start all the magic weapon to defeat the film King, however, the start of the first magic weapon need to consume a mana is not less than the AI and aesthetic degree is not less than the magic Stone, now the warrior has m block of magic Stone, the magic stone of the Block I mana is CI, beauty degree for Di, Warriors want The minimum amount of mana required to consume a magic stone.

"Input Format"

Line 1th: 2 integers n, M.

Next n rows: 2 integers per line ai,bi.

Next m line: 2 integers per line ci,di.

"Output Format"

An integer that represents the minimum value of the sum of the mana value that needs to be consumed by the magic stone.

If you cannot defeat the film King, Output "Failed".

"Data Range"

For 30% of data, 1≤n≤5000,1≤m≤5000

For 100% of data, 1≤n≤100000,0≤m≤100000

Write your own exam summary 9.10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.