PivotOJ

Festival

시간 제한: 1000ms메모리 제한: 2048MB출처: IOI 2025BOJ 34241

문제

Nayra is at a festival playing a game where the grand prize is a trip to Laguna Colorada. The game consists of using tokens to buy coupons. Buying a coupon may result in additional tokens. The goal is to get as many coupons as possible.

She starts the game with AA tokens. There are NN coupons, numbered from 00 to N1N-1. Nayra has to pay P[i]P[i] tokens (0i<N0 \leq i < N) to buy coupon ii (and she must have at least P[i]P[i] tokens before the purchase). She can buy each coupon at most once.

Moreover, each coupon ii (0i<N0 \leq i < N) is assigned a type, denoted by T[i]T[i], which is an integer between 11 and 44, inclusive. After Nayra buys coupon ii, the remaining number of tokens she has gets multiplied by T[i]T[i]. Formally, if she has XX tokens at some point of the game, and buys coupon ii (which requires XP[i]X \geq P[i]), then she will have (XP[i])T[i](X - P[i]) \cdot T[i] tokens after the purchase.

Your task is to determine which coupons Nayra should buy and in what order, to maximize the total number of coupons she has at the end. If there is more than one sequence of purchases that achieves this, you may report any one of them.

코드를 제출하려면 로그인하세요.