Programmers Contest: Fit pictures on a page

Isn't that an NP-complete problem or am I crazy?