Mana (mana)

261 teams scored 14137 points on this task, for a maximum score of 100, an average score of 54 and a median score of 43.

Highlights

  1. I.S. Castelli, Brescia is the institute with the most points (408).
  2. Lombardia is the region with the most points (2958).

Statement

Dario is addicted to card games and loves to optimize every play he makes. Today, he discovered a new game. You are given a deck of N cards, numbered from 0 to N - 1 starting from the top of the deck. To play a card, you must pay its mana cost: playing card i costs C_i mana. At the beginning of the game, you draw 2 cards from the top of the deck. Then, you can play cards using the following procedure: play one of the 2 cards in your hand (paying its mana cost) and place it at the bottom of the deck, then draw a card from the top of the deck. Dario's goal is to play K cards while spending the smallest amount of mana possible. What is the minimum amount of mana Dario needs to spend?