#P14034. [PAIO 2025] Cards
[PAIO 2025] Cards
题目背景
DO NOT include cards.h
. Submit using C++ >=17.
题目描述
You have black, white, and cyan cards (total ). You will play all the cards one by one onto a single pile in any order you choose.
After you place each card, check the pile:
- If the pile (now) contains at least one card of each of the three colors, you score 1 point, then all cards except the one you just played are destroyed (removed from the pile). The card you just played remains as the only card on the pile.
- Otherwise, nothing happens.
Your task is to calculate the maximum score you can get.
Implementation Details
You need to implement one procedure called maximum_score
:
int64 maximum_score(int32 X, int32 Y, int32 Z);
- : the number of black cards;
- : the number of white cards;
- : the number of cyan cards;
- This procedure might be called no more than 100 times for each test case at the beginning of the program.
The procedure should return the maximum score you can get.
提示
Examples
Example 1
Consider the following call.
maximum_score(2, 2, 1);
The procedure should return 2.
Example 2
Consider the following call.
maximum_score(4, 3, 4);
The procedure should return 5.
Sample Grader
The sample grader reads the input in the following format:
- Line 1: An integer , indicating the number of calls to
maximum_score
- Next lines: Three integers and
The sample grader calls maximum_score(X, Y, Z)
and prints the returned value.
Constraints
Scoring
- Subtask 1 (4 points):
- Subtask 2 (7 points):
- Subtask 3 (15 points):
- Subtask 4 (25 points):
- Subtask 5 (12 points):
- Subtask 6 (24 points):
- Subtask 7 (13 points): No additional constraints