# DCP-98: How Lazy One can be Part 2 Back to All Problems

Medium Data Structures > Basic Data Structures

Our Lazy Arnab is happily married with his love of life “you know who” and they have a cute baby boy “why I am”. Class teacher of “Why I am” gives him a task to solve. As “Why I am” is also too Lazy as like his father Arnab so he asks your help to solve this problem. A sequence of N positive integers **(1 < N < 100 000)**, each of them less than or equal **10000**, and a positive integer **S (S < 100 000 000)** are given. “Why I am” need to find the minimal length of the subsequence of consecutive elements of the sequence, the sum of which is greater than or equal to S. If there is no such consecutive subsequence print **-1**. Input: ------ Input starts with an integer T (≤ 100), denoting the number of test cases. Each test case consists of two line of input . First line consists of two integers N and S. Then N numbers of the sequence are given in the second line of the test case, separated by spaces. Output: ------- For each case, print the case number and the minimum length of the subsequence of consecutive elements of the sequence, the sum of which is greater than or equal to S. Sample Input ------------ 2 10 15 5 1 3 5 10 7 4 9 2 8 5 11 1 2 4 3 5 Sample Output ------------- Case 1: 2 Case 2: 3

### Problem Limits

 Language Time Limit (seconds) C 0.75 C++ 0.75 C++14 0.75 C# 1.00 Go 1.00 Java 1.00 JavaScript 1.00 Objective-C 1.00 Perl 1.00 PHP 1.00 Python 1.00 Python3 1.00 Ruby 1.00 VB.Net 1.00

# 126/309

Solve/Submission

### Ranking

# User Language Timing
01 Morass Cpp14 0.01s
02 monir769 Cpp14 0.02s
03 mir003 Cpp 0.03s
04 twyu0721 Cpp 0.03s
05 prateepm Cpp14 0.03s
06 Sarwar05 Cpp 0.03s
07 Key_logger Cpp14 0.03s
08 anik_JU Cpp 0.03s
09 feodorv C 0.03s
10 dip_BRUR Cpp14 0.03s
11 tariqiitju Cpp14 0.03s
12 sakib_muhit Cpp14 0.03s
13 rayhan50001 Cpp14 0.03s
14 seyedssz Cpp14 0.03s
15 _dipu Cpp14 0.04s
16 daihan_mbstu Cpp14 0.04s
17 Sajal_Deb Cpp 0.04s
18 pulak_ict_mbstu Cpp14 0.05s
19 Silent_Warrior Cpp 0.07s
20 bishal_biswas Cpp 0.08s
21 a_rahman Cpp14 0.08s
23 emrul Cpp14 0.09s
24 ash12 Cpp14 0.10s
25 haasib Cpp14 0.10s
26 Rakib05 C 0.10s
27 RandyWaterhouse Cpp 0.10s
28 prantacse14 Cpp14 0.10s
30 devcoder CSharp 0.11s
31 SakibAlamin Cpp14 0.11s
32 abdulmukit Cpp 0.11s
33 nurshuvo51 Cpp 0.12s
34 Robbinb1993 Cpp 0.12s
35 zyyxxx Cpp14 0.12s
37 nuhu_iu Cpp14 0.19s
38 MaknunLakme Cpp14 0.24s
39 ISMAIL_HOSSAIN Cpp14 0.26s
40 MASUDUR_RAHMAN Cpp14 0.27s
42 inzamamdu Cpp14 0.28s
43 Zayed Cpp14 0.30s
44 Ihtiaz Cpp14 0.33s
45 moinul_shaon Cpp14 0.33s
46 abinash Cpp14 0.34s
47 Unseen Cpp14 0.35s
48 dipta007 Cpp14 0.36s
49 mamun4122 Cpp14 0.37s
50 ahmeddinar Cpp14 0.37s
Feedback