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

11855번 - Bank 서브태스크다국어

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

문제

N people came to some bank to get their salary of a1, a2, . . . , aN tenge. There are total M banknotes left in the bank with values b1, b2, . . . , bM tenge correspondently.

You need to determine whether bank is able to give exact salary to all people using given banknotes or not.

입력

First line of input file contains two integers N and M — number of people and number of banknotes. Second line contains N integers a1, a2, . . . , aN (1 ≤ ai ≤ 1000) — salary values. Third line contains M integer numbers b1, b2, . . . , bM (1 ≤ bi ≤ 1000) — values of banknotes .

출력

The output file must contain one word «YES», if bank is able to pay salary. In opposite case output «NO».

제한

서브태스크

번호배점제한
119

N = 1, 1 ≤ M ≤ 20

225

1 ≤ N, M ≤ 10

327

1 ≤ N ≤ 20, 1 ≤ M ≤ 14

429

1 ≤ N, M ≤ 20

예제 입력 1

1 5
8
4 2 5 1 3

예제 출력 1

YES

예제 입력 2

2 6
9 10
5 4 8 6 3 11

예제 출력 2

NO

힌트

출처

Olympiad > International Zhautykov Olympiad > IZhO 2014 B번

  • 빠진 조건을 찾은 사람: yclock

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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