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

34397번 - Ultimate License Plate 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 2048 MB333100.000%

문제

A robber stole a very expensive cheese grater from Pear, the world's most valuable tech company. You have been hired as a detective to catch the robber and recover the cheese grater. There was not much information about the robber aside from a few witnesses who saw the getaway car the robber escaped in. While none of the witnesses remember the complete license plate of the car, they remember some details about it. Each witness you interviewed knew the maximum number of times a certain character appeared on the license place. The figure shows an example of a license plate that would not be possible if a witness said that "X" appeared at most six times on the plate. Can you use this information to determine the number of possible license plates that match the descriptions from witnesses?

입력

The first line is an integer, $N$ (1ドル \leq N \leq 10$), specifying the number of characters on the car's license plate. The second line is an integer, $R$ (0ドル \leq R \leq 10$), specifying the number of restrictions that were gathered. The next $R$ lines each contain a single restriction. Each restriction consists of a single ASCII character (either a capital English letter $\{A, B, \dots, Y, Z\}$ or a digit $\{0, 1, \dots, 8, 9\}$) followed by an integer, $K$ (0ドル \leq K \leq N$), specifying the number of times the corresponding character appears on the license plate. Note that the restrictions are unique: that is, the same character will not appear in more than one restriction.

출력

Output a single integer specifying the number of possible license plates given the $R$ restrictions.

제한

예제 입력 1

2
2
A 1
B 0

예제 출력 1

1224

노트

출처

School > CS@Mines > CS@Mines HSPC 2022 > Advanced J번

  • 문제를 만든 사람: Mohammed Alnasser
(追記) (追記ここまで)

출처

대학교 대회

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

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