## DMOPC '15 Contest 4 P4 - Great Sequence

View as PDF

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

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

Luke (perhaps Skywalker) is a passionate computer science student. He receives as homework the following task:

Given a sequence of integers, determine if the subsequence from to inclusive is a Great Sequence. A Great Sequence is a sequence that whose sum is strictly greater than .

Luke thought this is too easy, so he has thought up a new challenge: he'd like to know if a subsequence is an Amazing Sequence. An Amazing Sequence is a Great Sequence in which the integers and appear. Given his original sequence, he'd like to answer queries, determining if a subsequence is an Amazing Sequence.

#### Constraints

For all subtasks, and and .

#### Input Specification

The first line of input will contain the space-separated integers , and . The second line of input will contain space-separated integers representing the sequence. For the last lines, line will contain query in the format , , and .

#### Output Specification

For each query, print Yes if the subsequence is an Amazing Sequence, No otherwise.

#### Sample Input

5 6 3
1 3 4 5 6
3 6 2 5
1 4 1 4
5 6 1 3

#### Sample Output

Yes
Yes
No

• commented on Nov. 7, 2019, 11:06 a.m. edit 3

Anyone know why I am getting a null pointer exception? edit: nvm im bad

• commented on Nov. 4, 2018, 12:56 a.m.

What is wrong with my program? Second subtask passes

• commented on Jan. 12, 2016, 7:46 p.m.

The problem is specifically asking for the subsequence starting from the xth integer to the yth integer (I guess the statement is incorrect, it should say "from the xth integer to the yth integer"). For example, if the sequence were 5, 6, 1, 2, 4, 2, 2 and xi=2 and yi=5, the subsequence would then be 6, 1, 2, 4.

• commented on Jan. 12, 2016, 7:52 p.m. edit 2

ok good, i was scared for a sec there, thx

• commented on Jan. 12, 2016, 2:20 p.m.

hi everybody, what does mean |R?

• commented on Jan. 12, 2016, 2:25 p.m.

IR means Invalid Return: your program exited with a non-zero error code. You can hover over a status code to see a more detailed description.

• commented on Jan. 12, 2016, 1:17 p.m. edited

This comment is hidden due to too much negative feedback. Click here to view it.