306308: CF1176F. Destroy it!
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Destroy it!
题意翻译
你正在玩一款叫做Splay the Sire的电脑游戏。你现在面对的是最后的boss。 你需要进行$n$轮游戏。对于每一轮,你都会得到若干张卡片,其中第$i$张卡片的花费是$c_i$,造成的伤害是$d_i$。你可以从中选择一部分卡片,以任意顺序打出去,满足这些卡片的花费之和不超过$3$。每一张卡片只能在本轮使用,没有使用过的卡片作废。 你还发现,每$10$次攻击就会有一次暴击,暴击伤害翻倍。 现在你需要求出,$n$轮后你能造成的最大伤害是多少。题目描述
You are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game. The boss battle consists of $ n $ turns. During each turn, you will get several cards. Each card has two parameters: its cost $ c_i $ and damage $ d_i $ . You may play some of your cards during each turn in some sequence (you choose the cards and the exact order they are played), as long as the total cost of the cards you play during the turn does not exceed $ 3 $ . After playing some (possibly zero) cards, you end your turn, and all cards you didn't play are discarded. Note that you can use each card at most once. Your character has also found an artifact that boosts the damage of some of your actions: every $ 10 $ -th card you play deals double damage. What is the maximum possible damage you can deal during $ n $ turns?输入输出格式
输入格式
The first line contains one integer $ n $ ( $ 1 \le n \le 2 \cdot 10^5 $ ) — the number of turns. Then $ n $ blocks of input follow, the $ i $ -th block representing the cards you get during the $ i $ -th turn. Each block begins with a line containing one integer $ k_i $ ( $ 1 \le k_i \le 2 \cdot 10^5 $ ) — the number of cards you get during $ i $ -th turn. Then $ k_i $ lines follow, each containing two integers $ c_j $ and $ d_j $ ( $ 1 \le c_j \le 3 $ , $ 1 \le d_j \le 10^9 $ ) — the parameters of the corresponding card. It is guaranteed that $ \sum \limits_{i = 1}^{n} k_i \le 2 \cdot 10^5 $ .
输出格式
Print one integer — the maximum damage you may deal.
输入输出样例
输入样例 #1
5
3
1 6
1 7
1 5
2
1 4
1 3
3
1 10
3 5
2 3
3
1 15
2 4
1 10
1
1 100
输出样例 #1
263