Click
Here to go back to the homepage.
Delicious Bubble Tea Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int teas;
cin >> teas;
int teaprices[teas];
for(int i = 0; i < teas; i++){
cin >> teaprices[i];
}
int toppings;
cin >> toppings;
int toppingprices[toppings];
for(int i = 0; i < toppings; i++){
cin >> toppingprices[i];
}
int minimum = INT_MAX;
for(int i = 0; i < teas; i++){
int compatibletoppings;
cin >> compatibletoppings;
for(int j = 0; j < compatibletoppings; j++){
int toppingnum;
cin >> toppingnum;
minimum = min(teaprices[i] + toppingprices[toppingnum - 1], minimum);
}
}
int money;
cin >> money;
int result = money / minimum;
cout << (result == 0 ? 0 : result - 1);
return 0;
}