RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 R03700

S2. Jerseys

설명

A school team is trying to assign jerseys numbered \(1,2,3,\ldots,J\) to student athletes. The
size of each jersey is either small (S), medium (M) or large (L).

Each athlete has requested a specific jersey number and a preferred
size. The athletes will not be satisfied with a jersey that is the wrong
number or that is smaller than their preferred size. They will be
satisfied with a jersey that is their preferred size or larger as long
as it is the right number. Two students cannot be given the same
jersey.

Your task is to determine the maximum number of requests that can be
satisfied.

제약
입력 형식

The first line of input is the integer \(J\) which is the number of jerseys.

The second line of input is the integer \(A\) which is the number of athletes.

The next \(J\) lines are each the
character S, M or L. Line \(j\) gives
the size of jersey \(j\) \((1 \leq j \leq J)\).

The last \(A\) lines are each the
character S, M or L followed by a space followed by an integer. Line
\(a\) \((1 \leq a \leq A\)) gives the requested size and jersey number for
athlete \(a\) where the athletes are
numbered \(1,2,3,\ldots,A\).

For 50% of the test cases, \(1 \leq J \leq 10^3\) and \(1 \leq A \leq 10^3\).

For the remaining 50% of the test cases, \(1 \leq J \leq 10^6\) and \(1 \leq A \leq 10^6\).

출력 형식

The output will consist of a single integer which is the maximum
number of requests that can be satisfied.

예제 1
입력
4
3
M
S
S
L
L 3
S 3
L 1
출력
1
설명

Jersey 1 cannot be assigned because it is medium and athlete 3
requested large. No athlete requested jersey 2 or 4. Jersey 3 (small)
can be assigned athlete 2 (small) but not athlete 1 (large).

문제 정보

생성자가 기록되지 않았습니다.

출처 CCC 2015 Senior

평가 및 의견

S2. Jerseys

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

S2. Jerseys

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8