没有合适的资源?快使用搜索试试~ 我知道了~
第十届ICPC程序设计竞赛 陕西省省赛正式赛题目
需积分: 16 0 下载量 142 浏览量
2022-10-24
14:09:43
上传
评论
收藏 789KB PDF 举报
温馨提示
试读
26页
本资源为第十届ICPC程序设计竞赛陕西省省赛的正式赛题目,比赛时长一共五小时,题目为全英文题目,并且在比赛的时候可以使用一切纸质书籍,但禁止使用电子产品,一组三个队员,只允许使用一台电脑,不过可以配备打印机去打印题目。
资源详情
资源评论
资源推荐
The 2021 ICPC China Shaanxi Provincial
Programming Contest
Official Problem Set
#Contest Competition
2022.10.22
PLEASE!
DO
NOT
TOUCH
ANYTHING
UNTIL
TOLD TO DO SO!
请勿提前翻阅
hosted by Northwest A&F University
2021 China Shaanxi Provincial
1
Problem A
Tree
There is a country of n cities, and the capital of this country is city 1.
The cities of this country are interconnected by n−1 roads, forming a rooted tree, and the
root of this tree is 1.
You are a test sleeper who is in the capital of this country right now and you are planning a
trip.
You have the following requirements for this trip.
1. Each city in this country is very different, so you plan to sleep in each city for exactly one
night (you must sleep in a hotel in a particular city each night).
2. The distance between the cities where each of your adjacent nights are located, for time
reasons, cannot exceed k .
The distance between two cities is defined as the number of roads of a simple path between
these two nodes.
A simple path is a path that does not go through repeating nodes.
If there is a travel option that satisfies the condition, output "Yes" and output the city you are
in each night.
Otherwise, output "No".
Please note that you must stay in city 1 on the first night.
Input
There are two lines of input, the first line inputs two positive
integers n(2≤n≤2×10
5
) and k(1≤k≤2×10
5
).
The second line has n−1 positive integers separated by spaces, where the i-th positive
integer f
i+1
(1≤f
i+1
≤n) is city(i+1) 's father.
Output
The first line outputs "Yes" or "No", indicates the existence of a legitimate travel program
If the legitimate travel program exists, output n integers separated by spaces, the i-th
integer indicates the city where the i-th night is located. If more than one travel option exists
that satisfies the condition, output any one of them.
2021 China Shaanxi Provincial
2
Sample Input Sample Output
51
1123
No
Sample Input Sample Output
72
112233
Yes
1763254
Sample Input Sample Output
133
111222333444
Yes
11312114109837652
2021 China Shaanxi Provincial
3
Problem B
Card
There are N cards on the table , the value of the i-th (1≤i≤N) card is a
i
.
You need to perform the following operation exactly K times .
Choose a card i (1≤i≤N) , and change it's value to b
i
. Please notice that you can not
choose one card twice .
We prepared Q questions for you , each question is :
Firstly read M , and then read M integers id
1
,id
2
,...,id
M
. If you can not choose
cards id
1
,id
2
,...,id
M
, what is the maximum sum of the card's values after you perform the
operations above .
Input
There are two positive integers N,K(1≤K≤N≤10
5
) in the first line .
The second line has N positive integers indicates a
1
,a
2
,...,a
N
(1≤a
i
≤10
9
) .
The third line has N positive integers indicates b
1
,b
2
,...,b
N
(1≤b
i
≤10
9
) .
Then an positive integer Q(1≤Q≤10
5
) in a new line .
Then Q line follows , each line begins with an integer M(0≤M≤N−K) , then M integers
indicates id
1
,id
2
,...,id
M
( 1≤id
i
≤N,id
i
≠id
j
if i≠j ) .
Two adjacent integers in the same line are separated by a space .
The sum of M in Q queries is less than or equal to 10
6
.
Output
For each question , print an integer in one line indicates the answer .
Sample Input Sample Output
51
12345
54321
3
15
212
213
19
15
17
2021 China Shaanxi Provincial
4
Problem C
Type the strings
Alice have n strings named S
1
to S
n
. Each string has a length l
i
. Now she wants to type
them on the txt-editor (Sequence not required).
For each string S
i
, she has two choice.
The first choice is to type all characters of S
i
one by one (this will cost l
i
).
The second choice is to choose one string S
j
, which Alice has typed before , then paste it into
a single line (this will cost k) . Now we call this string S , Alice can perform the following
operation any time to get S
i
.
- Delete any character from S , each character costs 1 .
- Insert any character anywhere in S , each character costs 1 .
Such as we want to get abac from bdc , we will do the following operations :
1. Paste bdc into a new line , cost k .
2. Delete the 2nd character d in bdc to get bc , cost 1 .
3. Insert a before the first character of bc to get abc , cost 1 .
4. Insert a after the second character of abc to get abac , cost 1 .
Totally cost k+3 .
Now Alice wants to type all the strings , please help her to find the minimum cost .
Input
The first line contains two integer n (1≤n≤10
2
),k (1≤k≤10
2
) .
The next n lines , each line contains an integer l
i
(1≤l
i
≤10
2
), and a string S
i
with length l
i
,
Separates by a space .
S
i
only has lowercase letters .
Output
Print an integer — the minimum cost .
Sample Input Sample Output
剩余25页未读,继续阅读
凉云生烟
- 粉丝: 2w+
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0