What is the time complexity of solving the 0/1 knapsack problem with n items and capacity W using dynamic programming?