Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

AppleZ's blog

By AppleZ, 9 years ago, In Russian

Okey,

We have N numbers (1 <= N <= 100000),

and gives Q questions L & R (1 <= Q <= 100000),

we must find I and J (can be empty) between L and R,

that sum between I and J maximal,

and we must counted one number one times

Example:

INPUT:

9

{ 4, -2, -2, 3, -1, -4, 2, 2, -6 }

3

1 2

1 5

4 9

OUTPUT:

4

5

3

if my explanation not very good =)

You can found problem here

Please Help Me!! TNX!!!

  • Vote: I like it
  • +4
  • Vote: I do not like it