DCP-87: Credit Shop Back to All Problems

Easy Beginners Problems > Ad-hoc


You receive a credit C at Meena Bazar and would like to buy two items. You first walk through to nearest Meena Bazar store and create a list of all available items. From this list you would like to buy three items that add up to the entire value of the credit. The solution you provide will consist of the three integers indicating the positions of the items in your list (smaller number first). You need to print only the lexicographically smallest order. Input: ------ The first line of input gives the number of cases, T. T test cases follow. For each test case there will be: - One line containing the value **C**, the amount of credit you have at the store. - One line containing the value **I**, the number of items in the store. - One line containing a space separated list of **I** integers. Each integer **P** indicates the price of an item in the store. Constraints: ------------ - 5 ≤ C ≤ 1000 - 1 ≤ P ≤ 1000 - T = 100 - 3 ≤ I ≤ 2000 Output: ------- For each test case, output one line containing **"Case x: "** followed by the indices of the three items whose price adds up to the store credit. The lower index should be output first. If you don’t found those three items which adds up store credit print "**You are out of your luck!**" See the sample **I/O**. Sample Input ------------ 3 100 3 5 75 25 200 7 150 24 79 50 88 345 3 8 8 2 1 9 4 4 56 90 3 Sample Output ------------- Case 1: You are out of your luck! Case 2: You are out of your luck! Case 3: 2 4 8


Problem Setter:

Rezwanul Islam Maruf

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats

100/327

Solve/Submission

Ranking

# User Language Timing
01 subhashis_cse Cpp 0.01s
02 feodorv C 0.01s
03 twyu0721 C 0.01s
04 celeste871103 Cpp 0.01s
05 wayne6172 C 0.01s
06 souravahmed C 0.01s
07 Morass Cpp14 0.03s
08 emrul Cpp14 0.03s
09 tariqiitju Cpp14 0.05s
10 jahirtheboss Cpp14 0.09s
11 SONNET_N Cpp14 0.16s
12 rajdipsaha Cpp14 0.18s
13 J414N Cpp14 0.25s
14 Taj025 CSharp 0.29s
15 rabbicse CSharp 0.31s
16 abuasifkhan Cpp14 0.32s
17 moinul_shaon Cpp14 0.34s
18 belal_mbstu Cpp14 0.37s
19 dipta007 Cpp14 0.42s
20 imranziad Cpp14 0.43s
21 MAHRahat Cpp14 0.43s
22 Matrix_code Cpp14 0.44s
23 SugiuraAyano C 0.45s
24 Jumba Cpp14 0.47s
25 Riaz_BSMRSTU Cpp 0.48s
26 daihan_mbstu Cpp 0.48s
27 prateepm Cpp14 0.48s
28 akazad_cse13_ruet Cpp14 0.49s
29 Logic_Hunter Cpp14 0.50s
30 I_See_You Cpp14 0.50s
31 sahedsohel Cpp14 0.52s
32 ts01232165 C 0.53s
33 ssavi Cpp14 0.55s
34 fsshakkhor Cpp14 0.57s
35 pulak_ict_mbstu Cpp 0.57s
36 zyyxxx Cpp14 0.58s
37 abinash Cpp14 0.60s
38 shuvo_iu Cpp14 0.61s
39 nfssdq Cpp14 0.62s
40 shivazi Cpp14 0.62s
41 faisal47 Cpp14 0.65s
42 mamun4122 Cpp14 0.66s
43 mahbubcseju Cpp14 0.67s
44 khatribiru Cpp14 0.73s
45 Zayed Cpp14 0.73s
46 mtmohim Cpp14 0.74s
47 tashfiq123 Cpp14 0.75s
48 ddevilred1 Cpp14 0.82s
49 SleepyBrain Cpp14 0.84s
50 ash12 Cpp14 0.84s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support