## TLE '16 Contest 1 P1 - Buying Paper

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 128M

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Someone is going through his final year of high school. For privacy reasons, we will refer to him as "the CS nerd." He is thinking about prom and one specific girl. For privacy reasons, we will refer to her as "the girl."

The CS nerd wants to get the girl's attention. Upon asking his equally nerdy CS friends, he was suggested to air-drop thousands of papers littered with equations of cardioid graphs over the girl's house (the girl might or might not know what these equations even mean). However, the CS nerd needs many dimes/quarters to buy copious amounts of paper in order to accomplish this task. He isn't sure whether quarters (25 cents) are more efficient to bring than dimes (10 cents).

To help solve this question, his friends made very precise measurements of dimes and quarters. Dimes were measured times and quarters were measured times . It is guaranteed that each measurement is an integer between and .

After the friends made the measurements, they are still not sure about which coin is better. They want their answer to be 100% certain.

A coin's value is defined as number of cents divided by the mass. A 5 cent coin with a mass of 4 mg would have a value of 1.25.

Dimes are better if the heaviest dimes are strictly more valuable than the lightest quarters.

For example, if the heaviest dime weighs 1000 mg and the lightest quarter weighs 2501 mg, then dimes are better. If instead, the lightest quarter weighs 2500 mg, the answer cannot be 100% certain because neither coin would be better.

Similarly, quarters are better if the heaviest quarters are strictly more valuable than the lightest dimes.

#### Input Specification

The first line contains the integer .

The second line contains space separated integers, which are the weights of the measured dimes.

The third line contains the integer .

The fourth line contains space separated integers, which are the weights of the measured quarters.

#### Output Specification

If dimes are better, output Dimes are better.

If quarters are better, output Quarters are better.

Otherwise, output Neither coin is better.

#### Sample Input 1

5
1112 1101 1079 1104 1113
5
2605 2643 2618 2648 2656

#### Sample Output 1

Quarters are better

#### Sample Input 2

1
1000
1
2500

#### Sample Output 2

Neither coin is better

• commented on Dec. 24, 2016, 9:46 a.m.

Why I cannot pass case 7#????? Is there anybody who knows the trick??

• commented on Sept. 22, 2016, 4:23 a.m. edited

if the heaviest dime weighs 1000 mg and the lightest quarter weighs 2501 mg, then dimes are better.

Wait, this problem is telling me that dimes are better if the heaviest dime is lighter than the lightest quarter?

• commented on Sept. 22, 2016, 7:07 a.m.
• A coin's value is defined as number of cents divided by the mass. A 5 cent coin with a mass of 4 mg would have a value of 1.25.
• Dimes are better if the heaviest dimes are strictly more valuable than the lightest quarters.
• commented on Sept. 21, 2016, 8:04 p.m. edited

2656/25 is 106.24 < 1079/10 = 107.9

edit nvm

• commented on Sept. 21, 2016, 7:50 p.m.

gl cs nerd

• commented on Sept. 21, 2016, 2:33 p.m.

The problem statement has been updated to clear up some apparent confusion.

• commented on Sept. 21, 2016, 8:00 p.m.

dw it's still confusing