Fork Copy #include using namespace std; int giaCT[21]; int m; int n; int giaUuDai[30]; int soLinhKien[30]; int linhKien[30][20]; int coLinhKien[30][21]; int soLuongCanMua; int basePrice; int canMua[20]; int minPrice; int lkDaMua[20]; int goiDaMua[30]; void Try(int lk, int price){ // cout<=minPrice) return; // neu da co linh kien if (lkDaMua[canMua[lk]]>0) Try(lk+1, price); // mua pack, k mua ct else { // tim goi co linh kien chua mua for (int i=0;i>T; for (int tc=1;tc<=T;tc++){ cin>>n; for (int i=1;i<=n;i++) cin>>giaCT[i]; cin>>m; for (int i=0;i>giaUuDai[i]>>soLinhKien[i]; goiDaMua[i]=0; for (int j=0;j>linhKien[i][j]; coLinhKien[i][linhKien[i][j]]=1; } } cin>>soLuongCanMua; minPrice=0; for (int i=0;i>canMua[i]; lkDaMua[i]=0; minPrice+=giaCT[canMua[i]]; } Try(0, 0); cout<<"#"<