【SRM600】Div2 Easy, Medium 【Python】


Easy 250

The company Manao Inc. cares for its employees and tries to provide them with as much comfort as possible. One of the services Manao Inc. provides is transportation of employees from N distant locations to the office. The locations are numbered from 0 to N-1. You are given a tuple (integer) cnt containing N elements. The i-th (0-based index) element of cnt is the number of employees who live near location i. The company wants to purchase several shuttles of the same size. These shuttles will then be used for employee transportation. Each of the shuttles will only serve one particular location. Each location will be assigned the smallest number of shuttles sufficient to transport all of the employees living close to it. The cost of a shuttle consists of the cost baseCost of its frame and some additional cost seatCost per each seat. That is, a shuttle with X seats will cost baseCost + X * seatCost. For its shuttles, Manao Inc. can choose X to be any positive integer. (But remember that all the shuttles must have the same X.) Compute and return the least amount of money the company needs to spend on the shuttles in order to provide transportation for all employees.

いつものDiv2 Easyよりはちょっと複雑。

SRM600 Div2 Easy

Medium 600

Note that the memory limit for all tasks in this SRM is 256 MB. This problem statement contains subscripts that may not display properly if viewed outside of the applet. Manao is playing a solitaire game called OR-solitaire. In this game, the player starts with a number X = 0 and should obtain the number goal in one or more moves. The set of valid moves is determined by a tuple (integer) numbers. In each move, the player chooses some element of numbers and replaces X with the bitwise OR of X and the chosen element. Fox Ciel wants Manao to stop playing OR-solitaire and move on with his life. She decided to erase some of the elements from numbers in such a way that it becomes impossible to complete the game. Return the minimum number of elements that need to be removed to achieve this.

Bitいじるのは初めてだった。 SRM600 Div2 Medium