AT_scpc2026_div3_d.Sushisushi Conveyor Belt Sushi Restaurant

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

utilForever visited the Sushisushi conveyor belt sushi restaurant. Its conveyor belt has a total of NN positions where sushi can be placed. Initially, KiK_i pieces of sushi are stacked at the ii-th position, and eating the jj-th sushi from the top at the ii-th position gives satisfaction Xi,jX_{i,j}. Xi,jX_{i,j} may be negative.

Starting with today's lunch, utilForever will eat for TT days. At lunch each day, utilForever can eat at most one sushi, namely the top sushi among the sushi at position 11. The conveyor belt moves by 11 position every night. Sushi that was at position i+1i+1 moves to position ii, and sushi that was at position 11 moves to position NN.

Find the maximum possible total satisfaction utilForever can obtain.

utilForever 来到了寿司寿司(Sushisushi)回转寿司餐厅。其回转传送带共有 NN 个可放置寿司的位置。初始时,第 ii 个位置上叠放着 KiK_i 个寿司;在第 ii 个位置上,从上往下数第 jj 个寿司被吃掉时,带来的满足感为 Xi,jX_{i,j}。注意:Xi,jX_{i,j} 可能为负数。

从今天的午餐开始,utilForever 将连续进食 TT 天。每天午餐时,utilForever 最多只能吃一个寿司,且只能吃位于第 11 号位置的寿司堆中最上面的那个寿司。每晚传送带会向左移动一格:原来在第 i+1i+1 号位置的寿司移动到第 ii 号位置,而原来在第 11 号位置的寿司则移动到第 NN 号位置。

求 utilForever 能获得的最大总满足感。

输入格式

The input is given from Standard Input in the following format:

NN TT
K1K_1 X1,1X_{1,1} X1,2X_{1,2} …\dots X1,K1X_{1,K_1}
K2K_2 X2,1X_{2,1} X2,2X_{2,2} …\dots X2,K2X_{2,K_2}
⋮\vdots
KNK_N XN,1X_{N,1} XN,2X_{N,2} …\dots XN,KNX_{N,K_N}

输入从标准输入中按以下格式给出:

NN TT
K1K_1 X1,1X_{1,1} X1,2X_{1,2} …\dots X1,K1X_{1,K_1}
K2K_2 X2,1X_{2,1} X2,2X_{2,2} …\dots X2,K2X_{2,K_2}
⋮\vdots
KNK_N XN,1X_{N,1} XN,2X_{N,2} …\dots XN,KNX_{N,K_N}

输出格式

Output the maximum possible total satisfaction utilForever can obtain.

输出 utilForever 能够获得的最大总满意度。

输入输出样例

  • 输入#1

    4 10
    5 31 4 -15 9 26
    3 53 -5 -89
    3 -79 -32 -38
    0

    输出#1

    88

说明/提示

表示言語

/ /

Constraints

  • 1≤N,T≤1061 \leq N,T \leq 10^6
  • 0≤Ki≤1060 \leq K_i \leq 10^6
  • ∑i=1NKi≤106\sum_{i=1}^N K_i \leq 10^6
  • −100≤Xi,j≤100-100 \leq X_{i,j} \leq 100
  • All input values are integers.

表示语言

/ /

约束条件

  • 1≤N,T≤1061 \leq N,T \leq 10^6
  • 0≤Ki≤1060 \leq K_i \leq 10^6
  • ∑i=1NKi≤106\sum_{i=1}^N K_i \leq 10^6
  • −100≤Xi,j≤100-100 \leq X_{i,j} \leq 100
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页