LCC/Moose '20 Contest 5 S3 - Larry's Paradox

View as PDF

Submit solution

Points: 15 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

For those who aren't familiar, Larry's Paradox suggests that Larry can simultaneously play copious amounts of League while maintaining that he has no time for extracurriculars because he spends all his time studying for calculus.

Because of this supposed paradox, scientists have began to monitor Larry's activities during the day. During a period of N days scientists measure that Larry has played L games of League and has studied for S blocks of time each of varying length (assume Larry only studies and plays League). Due to shift changes, two study blocks may occur directly one after another. A study/play block must start and end on the same day.

After much research, scientists have discovered that each day of the N day period Larry drinks an identical, integer number of cans of ENARGHY DRYNK®. Scientists have theorized that each can of ENARGHY DRYNK® allows Larry to study/play at double speed (effectively adding one hour to each day), however if Larry drinks more than six cans of ENARGHY DRYNK® in one day he would likely overdose.

In order to check this theory they need to be able to predict the number of cans of ENARGHY DRYNK® that Larry drank over the N day period. Can you figure out the number of ENARGHY DRYNK® cans Larry would have to drink each day to maintain Larry's Paradox?

Input Specification

The first line consists of a single integer, N (1 \le N \le 365), the number of days where scientists have managed to record Larry's League and studying habits.

The second line consists of a single integer, L (1 \le L \le 10), the number of League games Larry has played during this period of time.

The third line consists of L integers, l_i (1 \le l_i \le 24), denoting that the i^\text{th} game of League lasted l_i hours.

The fourth line consists of a single integer, S (1 \le S \le 10), the number of blocks of time for which Larry has studied.

The fifth line consists of S integers, s_j (1 \le s_j \le 24), denoting that the j^\text{th} study block lasted s_j hours.

Output Specification

Output LIAR! if the minimum daily amount of ENARGHY DRYNK® that Larry would ingest with this model would cause an overdose. Otherwise output a single integer, the minimum number ENARGHY DRYNK® that Larry would have to consume each day to maintain Larry's Paradox.

Subtasks

Subtask 1 [5%]

This subtask accurately describes reality.

Subtask 2 [5%]

This subtask does not accurately describes reality.

Subtask 3 [90%]

No further restrictions.

Sample Input

3
3
12 13 12
3
12 13 12

Sample Output

1

Note: you do not necessarily have to pass the sample to get the first subtask.


Comments

There are no comments at the moment.