#include #include #include #include #include typedef unsigned int uint; int main() { int num_loop; std::cin >> num_loop; std::vector< std::pair > item; int maxValue; int tmpW = 0; for (uint i=0; i> v; std::cin >> w; item.emplace_back(v, w); tmpW += w; } std::cin >> maxValue; std::vector< std::vector< int > > c(num_loop+1, std::vector< int >(tmpW+1, 0)); std::vector< std::vector< int > > d(num_loop+1, std::vector< int >(tmpW+1, 0)); for (uint i=0; i maxValue) { if (flag) { max = j-1; flag = false; } } } std::cout << min << std::endl; if (flag) { std::cout << "inf" << std::endl; } else { std::cout << max << std::endl; } return 0; }