Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <vector>#include <algorithm>#include <fstream>#include <cmath>using namespace std;#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */#define INT_MAX 2147483647 /* maximum (signed) int value */int getMinHeight(int n, const vector<int>& width, const vector<int>& height, int m, int delete_index) {int current_height = 0;int remain_width = n;int total_height = 0;for (int i = 0; i < m; ++i) {if (i == delete_index) {continue;}int temp_width = width[i];int temp_height = height[i];if (temp_width > remain_width) {temp_height = ceil(((double)remain_width / temp_width) * (double)temp_height);temp_width = remain_width;}if (temp_height > current_height) {current_height = temp_height;}