SRM 629 div 1

easyだけ提出して通った
1220->1294

#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

class RectangleCovering{
public:
	int HH, WW;
	int n;
	int solve(int L, vector<int> V){
		sort(V.begin(), V.end());
		reverse(V.begin(), V.end());
		int ans = 0;
		while(L > 0){
			if(ans == V.size()) return 100;
			L -= V[ans];
			ans++;
		}
		return ans;
	}
	int minimumNumber(int hH, int hW, vector <int> bH, vector <int> bW){
		vector<int> H, W;
		n = bH.size();
		for(int i=0;i<n;i++){
			int h = bH[i], w = bW[i];
			int t = -1;
			if(h>=hH+1) t = w;
			if(w>=hH+1) t = max(h, t);
			if(t!=-1) H.push_back(t);
			int s = -1;
			if(h>=hW+1) s = w;
			if(w>=hW+1) s = max(h, s);
			if(s!=-1) W.push_back(s);
		}
		int ans = min(solve(hW, H), solve(hH, W));
		if(ans == 100) return -1;
		return ans;
	}
};