Logo
(追記) (追記ここまで)

10852번 - Carpets 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB89342641.935%

문제

The computer science Professor Toving Liles loves the floor tiles in his office so much that he wants to protect them from damage by careless students. Therefore, he would like to buy cheap small rectangular carpets from the supermarket and cover the floor such that:

  1. The entire floor is covered.
  2. The carpets do not overlap.
  3. The carpets are rotated arbitrarily.
  4. No carpet is cut into pieces.

But when checking the supermarket’s stock he begins to wonder whether he can accomplish his plan at all. Can you help him?

입력

The first line contains two integers W and H describing the size of his room (1 ≤ W, H ≤ 100). The second line contains an integer c, denoting the number of different carpet colors the supermarket has in stock (1 ≤ c ≤ 7).

Each of the following c lines consists of three integers ai, wi, and hi, which means: the supermarket’s stock contains ai carpets of size wi, hi and color i (1 ≤ ai ≤ 7; 1 ≤ wi ≤ 100; 1 ≤ hi ≤ 100).

The supermarket has at most 7 carpets, i.e. Σiai ≤ 7.

출력

For the given room dimensions and the supermarket’s stock of carpets, print “yes” if it is possible to cover the room with carpets as specified above and “no” otherwise.

제한

예제 입력 1

2 4
2
3 1 3
2 2 1

예제 출력 1

yes

예제 입력 2

100 100
3
4 42 42
1 100 16
1 32 42

예제 출력 2

no

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2015 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /