Vending Machines (vendingmachines)

337 teams scored 32520 points on this task, for a maximum score of 100, an average score of 96 and a median score of 100.

Highlights

  1. ITI Planck, Villorba is the institute with the most points (1300).
  2. Lombardia is the region with the most points (5480).

Statement

Carlo has bought T vending machines, each machine has N items, each with a price P_1, P_2, …, P_N. Each buyer can insert some money in the machine or buy an item. Each item can only be bought if there is enough money in the machine. After buying an item, the leftover money remains in the machine and can be used to buy another item. However, Carlo is worried than some machine might have been hacked! Luckily, Carlo has the history of the Q transactions that happened since the machine was turned on. Each transaction is represented by a signed integer L_i: (1) if the transaction is positive (i.e. +L_i) then L_i euros were inserted in the machine; (2) if the transaction is negative (i.e. -L_i) then item abs (L_i) was bought. If, at any point in time, the price of purchased items is greater than the inserted money then the machine was hacked. Help Carlo understand if his machines were hacked!