Skip to content

Commit d02afe2

Browse files
author
不断同学
committed
Update Problems
By Xuanran and me
1 parent 05c78cf commit d02afe2

File tree

6 files changed

+280
-0
lines changed

6 files changed

+280
-0
lines changed

Problems/A_show-off_cat.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
## Background and Problem description
3+
4+
The cat living next to DB, always a fan of shiny objects(Baling~ Baling~), has taken up a hobby of mining diamonds in her spare time! She has collected $N$ diamonds ($N \leq 50,000$) of varying sizes, and she wants to arrange some of them in **a pair of** display cases in her cattery.
5+
6+
7+
Since she wants the diamonds in each of the two cases to be relatively similar in size, she decides that she will not include two diamonds in the same case if their sizes differ by more than $K$ (two diamonds can be displayed together in the same case if their sizes differ by exactly $K$). Given $K$, please help her determine the maximum number of diamonds she can display in both cases together.
8+
9+
10+
## Input format
11+
12+
The first line of the input file contains $N$ and $K$ ($0 \leq K \leq 1,000,000,000$).
13+
14+
The next $N$ lines each contain an integer giving the size of one of the
15+
16+
diamonds. All sizes will be positive and will not exceed $1,000,000,000$.
17+
18+
## Output format
19+
20+
Output a single positive integer, telling the maximum number of diamonds that
21+
22+
**She can showcase in total in both the cases.**
23+
24+
## Sample input and output
25+
26+
### Input
27+
```
28+
7 3
29+
10
30+
5
31+
1
32+
12
33+
9
34+
5
35+
14
36+
```
37+
### Output
38+
```
39+
5
40+
```
41+
42+
## Data size
43+
44+
Those specific value ranges can be found above.

Problems/ForumArrangement.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### Problem Description
2+
3+
Imagine you are Liu Baicen, the vice president of the Computer Psycho Union, and you are now responsible for arranging the list of presenters for weekly activities. This semester, there are a total of 8 weekly activities, with each activity having `n` people presenting (0<n<=5). The technical department has `x` members (x>=15), who are proficient in `y` different fields (x>y>5\). Each member is only proficient in one field, and each field must have at least one expert.
4+
5+
You want the presentation counts for each field and each individual to be as evenly distributed as possible, so a variance less than 1 can be considered a feasible solution. The variance can be calculated using the following formula:
6+
$$
7+
\text{Var}_x = \frac{1}{x} \sum_{i=1}^x (P_i - P_{\text{avg}})^2 ; \text{Var}_y = \frac{1}{y} \sum_{j=1}^y (A_j - A_{\text{avg}})^2
8+
$$
9+
where:
10+
$$
11+
P_{\text{avg}} = \frac{8 \times n}{x}, \quad A_{\text{avg}} = \frac{8 \times n}{y}
12+
$$
13+
Additionally, in each activity, content from the same field will appear only once, and no individual will present more than once in the same activity. To ensure students get rest, no one will participate in two consecutive activities.
14+
15+
### Input Format
16+
17+
The first line contains three integers n, x, and y, representing the number of presenters in each weekly activity, the number of members in the technical department, and the number of fields they are proficient in. For example, `3 15 4` means each activity has 3 presenters, the technical department has 15 members, and they are proficient in 4 different fields.
18+
19+
The second line lists the fields each of these `x` members are proficient in, separated by spaces.
20+
21+
Example:
22+
23+
```
24+
3 15 3 // 3 presenters per activity, 15 members in the technical department, proficient in 3 fields
25+
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
26+
```
27+
28+
### Output Format
29+
30+
The first line of the output contains an integer representing the number of feasible scheduling solutions.
31+
32+
If there are no feasible schedules, output "0".
33+
34+
Example:
35+
36+
```
37+
0
38+
```
39+
40+
### Problem Constraints
41+
42+
Memory: 512 MiB
43+
44+
Time: 1000ms
45+
46+
47+
48+
49+

Problems/Gambling games.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Gambling games
2+
3+
### Problem Description
4+
5+
As an OIer who loves gambling, you have received a rare ticket to enter the only profitable casino in the world. There are n prize pools in the casino, and the bonus of the i-th prize pool is ai. Each prize pool has a parameter bi (1<=bi<=n)
6+
7+
The casino rules are as follows:,
8+
9+
At the beginning, players will be provided with a prize pool, and whenever they are given the i-th prize pool, they have two options:
10+
11+
1. Obtain the prize money from this prize pool.
12+
2. Skip the prize money in this pool, so they will never be able to receive the prize money in this pool.
13+
14+
Afterwards, the casino will offer players another prize pool based on the following rules
15+
16+
If the player selects prize pool i, they will choose a prize pool within the range of j<i
17+
18+
If the player skips prize pool i, they will choose a prize pool within the range of j<bi
19+
20+
Among these prize pools, it will choose the one with the highest index, which has never been given to players before (players have neither selected nor skipped it before). If there is no such prize pool, then the player's gambling is over, and their prize money is equal to the total prize money of all the selected prize pools. Especially, if players choose the first prize pool, their gambling is over. Note that players can receive a maximum of one prize pool per game.
21+
22+
Now that you have arrived at this casino, please write a program to calculate the maximum bonus you can receive.
23+
24+
#### input
25+
26+
Each test consists of multiple test cases. The first line contains an integer t (1 ≤ t ≤ 10 ^ 5) - the number of test cases. The description of the test cases is as follows.
27+
28+
The first line of each test case contains an integer n (1 ≤ n ≤ 4 ⋅ 10 ^ 5) - the number of prize pools.
29+
30+
The second line of each test case contains n integers a1, a2,..., an (1 ≤ ai ≤ 10 ^ 9) - the prize money in the prize pool.
31+
32+
The third line of each test case contains n integers b1, b2,..., bn (1 ≤ bi ≤ n) - the parameters of the prize pool.
33+
34+
Ensure n
35+
36+
All test cases shall not exceed 4 ⋅ 10 ^ 5.
37+
38+
#### output
39+
40+
For each test case, output an integer - the highest score you can obtain.
41+
42+
### Input Format
43+
44+
```
45+
4
46+
2
47+
15 16
48+
2 1
49+
5
50+
10 10 100 100 1000
51+
3 4 1 1 1
52+
3
53+
100 49 50
54+
3 2 2
55+
4
56+
100 200 300 1000
57+
2 3 4 1
58+
```
59+
60+
### Output Format
61+
```
62+
16
63+
200
64+
100
65+
1000
66+
```

Problems/Let's make friends!.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
## Background and Problem description
3+
4+
After going through numerous hardships, the duckling finally arrived at DB and met the cat and her display case of diamonds. However, an awkward situation arose: they couldn't understand each other's language (duckling: Quack? Quack? cat: Meow? Meow?), which made communication difficult.
5+
6+
To solve this problem, they found a dictionary to help them understand what the other was saying. The rules for using the dictionary are as follows: the dictionary contains only two lines (one for each animal's language), and we know that the information expressed in the second line is a substring of the first line. Your task is to act as a translator and find the first position where the information from the second line appears in the first line.
7+
8+
## Input format
9+
10+
The first line of input contains the message described in a certain language. This message will not contain more than **10<sup>6</sup>** characters. There will be exactly one whitespace between adjacent words, and the end of the line will be marked with \$. Characters after \$ will not be considered part of the message.
11+
12+
The following line contains the sentence described in another language, which we need to find in the first line. This sentence will also not be longer than **10<sup>6</sup>** characters and will follow the same format as described above.
13+
14+
Except for the last character \$, all other characters are English letters and spaces.
15+
16+
17+
## Output format
18+
19+
Output the position where the sentence from the second line first appears in the message from the first line.
20+
**Solution will always exist.**
21+
22+
## Sample input and output
23+
24+
### Input
25+
```
26+
miao meow meow woof hello $
27+
ga quack moo $
28+
```
29+
### Output
30+
```
31+
3
32+
```
33+
34+
## Data size
35+
36+
Those specific value ranges can be found above.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
## Background and Problem description
3+
4+
After a series of training sessions, the ducklings have grown significantly. One day, they decided to visit the cat living next to DB (they heard that this cat has recently been playing with some shiny objects).
5+
6+
There is a river between the two places, so the ducklings plan to jump across the stones in the river to reach the other side. Since this is a very dangerous task, only one duckling will be chosen to visit the cat (due to their caretakers' extreme stinginess with their gold coins, none of them can swim or fly).
7+
8+
The stones in the river are arranged in a straight line, and each jump the duckling makes must land on a stone or on the shore. However, each stone has a certain height, and every time a duckling jumps from a stone, the height of that stone decreases by 1. When the height of a stone drops to 0, the duckling can no longer land on it (though making a jump that causes the stone's height to drop to 0 is allowed).
9+
10+
The duckling needs to visit the cat's house **x** times, meaning it must make **2x** round trips. When a duckling has a jumping ability **y**, it can jump a maximum distance of **y**.
11+
12+
What is the minimum jumping ability the duckling must have to use these stones to complete the **x** visits? (Those stingy caretakers should be criticized once again!)
13+
14+
15+
## Input format
16+
17+
The first line of input contains two integers, **n** and **x**, representing the width of the river and the number of times the duckling needs to visit. Note that **2x** is the actual number of times the river must be crossed.
18+
19+
The second line contains **n-1** non-negative integers **H<sub>1</sub>, H<sub>2</sub>, ..., H<sub>n-1</sub>**, where **H<sub>i</sub> > 0** indicates that there is a stone at a distance of **i** from the duckling's home with a height of **H<sub>i</sub>**, and **H<sub>i</sub> = 0** means there is no stone at that position.
20+
21+
22+
## Output format
23+
24+
Output a single line containing one integer, representing the minimum jumping ability required for the duckling.
25+
26+
(Poor duckling, bad caretakers (¨s¨‰Ãó¨‰)¨s)
27+
28+
## Sample input and output
29+
30+
### Input
31+
```
32+
5 1
33+
1 0 1 0
34+
```
35+
### Output
36+
```
37+
4
38+
```
39+
40+
## Data size
41+
42+
For all test cases:
43+
- **1 &le; n &le; 10<sup>5</sup>**
44+
- **1 &le; x &le; 10<sup>9</sup>**
45+
- **0 &le; H<sub>i</sub> &le; 10<sup>4</sup>**
46+

Problems/Traing.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Background and Problem description
2+
3+
In UNNC, **n ducklings** have recently been born, and these ducklings need to undergo a series of special training sessions to improve their survival skills. For the **i-th duckling**, the cost for one training session is **p<sub>i</sub>** gold coins, and to become a qualified duckling, it needs at least **c<sub>i</sub>** training sessions.
4+
5+
To ensure the efficiency of the training, you (or your team) have been chosen as caretakers and have introduced a group training scheme. This scheme allows for a training session for each duckling, with a total cost of **S** gold coins (the group training scheme can be purchased multiple times, meaning the ducklings can undergo group training sessions multiple times).
6+
7+
As a responsible caretaker, please calculate the minimum amount of gold coins required to ensure that all the ducklings become qualified.
8+
9+
## Input format
10+
11+
The first line of input contains two integers, **n** and **S**, separated by a space, representing the number of ducklings and the cost of a group training session in gold coins.
12+
13+
The following **n** lines each contain two integers, **p<sub>i</sub>** and **c<sub>i</sub>**, separated by a space, indicating the cost of one training session in gold coins for the **i-th duckling** and the number of training sessions needed for the **i-th duckling** to become qualified.
14+
15+
## Output format
16+
17+
The output should consist of a single line containing one integer, representing the minimum number of gold coins needed to ensure that all the ducklings become qualified.
18+
19+
20+
## Sample input and output
21+
22+
### Input
23+
```
24+
3 6
25+
5 2
26+
2 4
27+
3 2
28+
```
29+
### Output
30+
```
31+
16
32+
```
33+
34+
## Data size
35+
36+
For all test cases:
37+
- **1 &le; n &le; $10^5$**
38+
- **1 &le; p<sub>i</sub>, c<sub>i</sub> &le; $10^6$**
39+
- **1 &le; S &le; $10^{10}$**

0 commit comments

Comments
 (0)