#K82097. Lucky Draw Approval

    ID: 35899 Type: Default 1000ms 256MiB

Lucky Draw Approval

Lucky Draw Approval

During a lucky draw event, participants submit requests to win prizes. There are n different prize types, each with a given available count. Each request consists of a prize type (1-indexed) and a participant ID. Process each request in order: if the prize is available (i.e., if \( prizes[t-1] > 0 \)), output ACCEPT and decrease the count for that prize type by 1; otherwise, output REJECT.

inputFormat

The input consists of multiple lines:

  1. The first line contains an integer n, the number of prize types.
  2. The second line contains n space-separated non-negative integers representing the available prize counts for each type.
  3. The third line contains an integer m, the number of requests.
  4. Each of the following m lines contains two space-separated integers: t (the prize type, 1-indexed) and id (the participant identifier). The id is not used in the decision process.

outputFormat

Output m lines. For each request, print either ACCEPT if the corresponding prize is available or REJECT if it is not.## sample

3
5 0 2
5
1 100
2 101
3 102
1 103
3 104
ACCEPT

REJECT ACCEPT ACCEPT ACCEPT

</p>