class Cashier {
int n, discount;
unordered_map<int,int>hash;
int cnt;
public:
Cashier(int n, int discount, vector<int>& products, vector<int>& prices) {
this->n = n;
this->discount = discount;
for(int i = 0; i < products.size(); i++)
{
hash[products[i]] = prices[i];
}
cnt = 0;
}
double getBill(vector<int> product, vector<int> amount) {
double res = 0;
cnt++;
for(int i = 0; i < product.size(); i++)
{
res += hash[product[i]] *amount[i];
}
if(cnt == n)
{
res -= (discount*res/100);
cnt = 0;
}
return res;
}
};
/**
* Your Cashier object will be instantiated and called as such:
* Cashier* obj = new Cashier(n, discount, products, prices);
* double param_1 = obj->getBill(product,amount);
*/