CF1574D.The Strongest Build
普及+/提高
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Ivan is playing yet another roguelike computer game. He controls a single hero in the game. The hero has n equipment slots. There is a list of ci items for the i-th slot, the j-th of them increases the hero strength by ai,j. The items for each slot are pairwise distinct and are listed in the increasing order of their strength increase. So, ai,1<ai,2<⋯<ai,ci.
For each slot Ivan chooses exactly one item. Let the chosen item for the i-th slot be the bi-th item in the corresponding list. The sequence of choices [b1,b2,…,bn] is called a build.
The strength of a build is the sum of the strength increases of the items in it. Some builds are banned from the game. There is a list of m pairwise distinct banned builds. It's guaranteed that there's at least one build that's not banned.
What is the build with the maximum strength that is not banned from the game? If there are multiple builds with maximum strength, print any of them.
伊万正在玩另一款类Roguelike电脑游戏。他在游戏中控制一名英雄。该英雄有 n 个装备栏位。第 i 个栏位有 ci 件可选物品,其中第 j 件物品使英雄力量提升 ai,j。每个栏位的物品互不相同,且按其力量提升值升序排列,即满足 ai,1<ai,2<⋯<ai,ci。
对于每个栏位,伊万必须恰好选择一件物品。设第 i 个栏位所选物品为其对应列表中的第 bi 件,则选择序列 [b1,b2,…,bn] 称为一个“构筑”(build)。
一个构筑的力量值等于其所选所有物品的力量提升值之和。游戏中存在若干被禁止的构筑。给定一个包含 m 个两两不同的被禁构筑的列表。保证至少存在一个未被禁止的构筑。
请找出所有未被禁止的构筑中力量值最大的那个。若存在多个力量值最大的未被禁止构筑,输出任意一个即可。
输入格式
The first line contains a single integer n (1≤n≤10) — the number of equipment slots.
The i-th of the next n lines contains the description of the items for the i-th slot. First, one integer ci (1≤ci≤2⋅105) — the number of items for the i-th slot. Then ci integers ai,1,ai,2,…,ai,ci (1≤ai,1<ai,2<⋯<ai,ci≤108).
The sum of ci doesn't exceed 2⋅105.
The next line contains a single integer m (0≤m≤105) — the number of banned builds.
Each of the next m lines contains a description of a banned build — a sequence of n integers b1,b2,…,bn (1≤bi≤ci).
The builds are pairwise distinct, and there's at least one build that's not banned.
第一行包含一个整数 n(1≤n≤10)—— 表示装备槽的数量。
接下来的 n 行中,第 i 行描述第 i 个装备槽可选的物品。首先是一个整数 ci(1≤ci≤2⋅105)—— 表示第 i 个装备槽的物品数量;随后是 ci 个整数 ai,1,ai,2,…,ai,ci(1≤ai,1<ai,2<⋯<ai,ci≤108)。
所有 ci 的总和不超过 2⋅105。
下一行包含一个整数 m(0≤m≤105)—— 表示被禁止的装备组合数量。
接下来的 m 行每行描述一个被禁止的装备组合:即一个由 n 个整数组成的序列 b1,b2,…,bn(1≤bi≤ci)。
所有被禁止的装备组合两两不同,且至少存在一个未被禁止的装备组合。
输出格式
Print the build with the maximum strength that is not banned from the game. If there are multiple builds with maximum strength, print any of them.
输出游戏中未被禁止的、强度最大的构筑。如果存在多个强度最大的构筑,则输出其中任意一个。
输入输出样例
输入#1
3 3 1 2 3 2 1 5 3 2 4 6 2 3 2 3 3 2 2
输出#1
2 2 3
输入#2
3 3 1 2 3 2 1 5 3 2 4 6 2 3 2 3 2 2 3
输出#2
1 2 3
输入#3
3 3 1 2 3 2 1 5 3 2 4 6 2 3 2 3 2 2 3
输出#3
3 2 2
输入#4
4 1 10 1 4 1 7 1 3 0
输出#4
1 1 1 1
输入解题思路,AI测评打分。不知道怎么写?