#C2408. Alice's Challenge

    ID: 45721 Type: Default 1000ms 256MiB

Alice's Challenge

Alice's Challenge

In this problem, you are given an initial problem-solving speed of Alice and a series of queries representing updates to her abilities and challenge attempts. There are three types of queries:

  1. Update Skill Level: Increase Alice's skill level by a given amount. The query is given in the format:

(1\ x\ 0\ 0)

where (x) is the increment.

  1. Update Speed: Change Alice's problem-solving speed. The query is given in the format:

(2\ 0\ y\ 0)

where (y) is the new speed.

  1. Challenge Query: Determine whether Alice can solve (n) challenges of a given difficulty within a specified time limit. The query is given in the format:

(3\ n\ d\ t)

Here, (n) is the number of challenges, (d) is the difficulty level and (t) is the time limit. Alice can solve the challenge if and only if her current skill level is at least (d) and the required time to solve (n) challenges, calculated as (\frac{n}{s}) (where (s) is her current speed), is less than or equal to (t).

Your task is to process the queries in the given order and print the result of each challenge query. For a challenge query, output "SUCCESS" if Alice can solve the challenges and "FAILURE" otherwise.

Input Format:

  • The first line contains a number \(s\) representing the initial speed.
  • The second line contains an integer \(q\) representing the number of queries.
  • The following \(q\) lines each contain a query. Every query is guaranteed to have 4 space-separated integers. For query type 1, the format is: 1 x 0 0; for type 2: 2 0 y 0; and for type 3: 3 n d t.

Output Format: For each challenge query (query type 3), output the result on a new line: either "SUCCESS" or "FAILURE".

Note: All arithmetic involving time should be computed using real (floating point) division. Make sure to adhere strictly to the input/output format for your solution to be accepted.

inputFormat

The input is read from standard input (stdin) and is structured as follows:

  1. The first line contains a real number s: the initial problem-solving speed of Alice.
  2. The second line contains an integer q: the number of queries.
  3. Each of the next q lines contains 4 integers representing a query.
    • Type 1 (Skill Level Update): 1 x 0 0 (increase skill level by x).
    • Type 2 (Speed Update): 2 0 y 0 (change speed to y).
    • Type 3 (Challenge Query): 3 n d t (n is the number of challenges, d is difficulty, and t is the time limit).

outputFormat

For each challenge query (type 3), output a single line containing either "SUCCESS" or "FAILURE" (without quotes) to standard output (stdout).

## sample
10
5
1 5 0 0
3 1 10 5
2 0 15 0
3 2 20 2
3 5 30 20
FAILURE

FAILURE FAILURE

</p>