Vasile and Haircuts

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 256M

Problem types
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

Vasile runs a barber shop. His customers tell him how long their hair is before he cuts it, and how much they want cut off.

Determine whether the length after the cut is inside the acceptable inclusive range.


The first line will contain an integer N, the number of haircuts he gives.

The following N lines contain 4 numbers. Each line represents a customer's order, where there will be four space-separated integers in the format L A B F, the initial length of the customer's hair, the minimum they want taken off, the maximum they want taken off, and the final length of their hair.


N lines, the i^{th} being Yes if the final length is within the acceptable range, or No if it isn't in the acceptable range.

Sample Input

20 5 10 12
10 2 4 8
15 3 5 10
3 1 2 3
20 2 3 1

Sample Output



  • -3
    moladan123  commented on Jan. 8, 2016, 5:47 p.m.

    That is a lot of authors you have there ;)

    • 3
      bobhob314  commented on Jan. 8, 2016, 6:16 p.m.

      Come on moladan I know you can do it :)