2163 - I2P(II)2020_Chen_week9_HW Scoreboard

Time

2020/11/10 23:59:00 2020/11/17 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12392 Heatstroke Bamboo Rats 2
12436 Hulk's Trouble
12494 minimum mean of rectangle sum

12392 - Heatstroke Bamboo Rats 2   

Description

This bamboo rat seems to have heatstroke, we might as well ......

── Brothers HuaNong

Brothers HuaNong feed a lot of bamboo rats. They do love to eat bamboo rats! However, some of the rats seems to have heatstroke. Brothers HuaNong couldn't bear to watch them suffer, and we all know how Brothers HuaNong treat those heatstroke rats...


Every bamboo rat has its level of heatstroke(中暑程度), Brother HuaNong would randomly choose a number . If there's a rat with level of heatstroke equals to , Brother HuaNong would think that the rat has heatstroke and eat it.

However, if they just keep eating those heatstroke rats, they would eat up all the rats eventually, so they also have to buy bamboo rats in case that too many rats have heatstroke.

You are hired by Brothers HuaNong. Brothers HuaNong will give you the level of heatstroke of every bamboo rats and several numbers . Your task is to help them find out if there's rats that have heatstroke.


This problem is partial judge. You are going to implement the following functions:

  1. void build_tree(Node **now, int *arr, int l, int r)

    When this function is called, you should build a binary search tree by the array arr.

  2. int query_heatstroke(Node *now, int x)

    This function is used to ask if there exists a node with level equals to x.

  3. void eat_rat(Node **root, int x)

    This function will delete one node with level equals to x.

  4. void buy_rat(Node **root, int x)

    This function will insert a node with level equals to x.


Take sample as an example, initially, the level of heatstroke of the rats would be (1, 8, 309).

  1. heatstroke 8: Exists a rat with level 8, eat it. The sequence becomes (1, 309).
  2. heatstroke 8: No rat with level 8. No dinner tonight.
  3. heatstroke 1: Exists a rat with level 1, eat it. The sequence becomes (309).
  4. heatstroke 309: Exists a rat with level 309, eat it. The sequence is now empty.
  5. buy 5: Add a new rat with level 5. The sequence becomes (5).
  6. heatstroke 5: Exists a rat with level 5, eat it. The sequence is now empty.

 

Input

The first line is an integer n, which indicates the number of bamboo rats.

The next line contains integers, indicate the level of heatstroke of every bamboo rat sorted in ascending order.

The third line is an integer q, which means there are queries below.

There are lines below.

In each queries, there are two operations:

  1. heatstroke x: eat a rat with level equals to if there exists one.
  2. buy x: buy a rat with level equals to x.

0 <= n <= 10^4,  1<= q <= 10^4, 1<= x <= 10^9, the level of bamboo rats have the same range as x.

Output

For each heatstroke operation, output "We might as well eat it." if there's a rat with the corresponding level, otherwise output "No dinner tonight."

Sample Input  Download

Sample Output  Download

Partial Judge Code

12392.c

Partial Judge Header

12392.h

Tags




Discuss




12436 - Hulk's Trouble   

Description

For the previous episode, click here.

Years after Thanos eliminated half lives of the universe and destroyed all the stones, Avengers finally gather 6 infinity stone and equip them onto the glove. The one who snaps the finger must be the strongest avenger. Everybody knows, the avenger is ThorHulk!

Hulk's duty is to revive all lives that was eliminated by Thanos. At the moment he snaps, his mind just enters into the deepest layer of the universe. Now, he can see the whole universe.

However, the amount of information is too large to find those eliminated people. Hulk asks you for help. Please help him to find out the information he needs.

hulk-thinking

Hulk Thinking About This Problem

If you click on this picture, something might happen...


There will be an integer sequence with length , which contains all the information that the universe has.

Hulk will give you several integers. He wants to know how many times the number appears in sequence .

For example, the sequence , then there are two 3, two 6, one 2, and one 5.

Input

The first line contains an integer .

The next line contains integers, which is the sequence .

The next line contains an integer , indicates the amount of numbers Hulk will ask you.

Then lines below, each line contains an integer .

 

Output

For each query, output the number of times that appears in sequence .

Sample Input  Download

Sample Output  Download

Tags




Discuss




12494 - minimum mean of rectangle sum   

Description

You are given a 2D matrix named with all slots are integers.

Each element can be represented as: , while indicate the line number of row and column, respectively.

Now, we define a rectangle sum as follows:

And we define mean of rectangle sum as follows:

You're going to calculate the minimum mean of rectangle sum in a 2D matrix.

That is, you need to find:

while indicate the number or row and column of matrix , respectively.

 

Take sample I/O as example, the matrix should be:

For the minimum choice, you may choose or , while the answer of both of them are .

Input

The first contains 2 integers , indicate the number or row and column of matrix , respectively.

The next lines contain the whole matrix . The -th line contains the -th row of the matrix.

, All elements in will be in range .

Output

The output should contains only the value of minimum mean of rectangle sum.

That is, find out:

and output its value.

Remember the print a '\n' at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss