DCP-8: Get the Numbers Back to All Problems

Easy Beginners Problems > Ad-hoc


One of our clients sent some SMS to some mobile numbers (of his customers). After he sent the SMS campaign, he wants to know which mobile numbers successfully received the SMS and which didn’t. His plan is to remove the undelivered mobile numbers from his list and only keep the one that successfully received the SMS so that when he send SMS next time the cost is reduced. Also he can contact the failed mobile number customers to correct their mobile numbers. But unfortunately when he went to the delivery report section of the SMS marketing service, he found that for security purpose in the delivery report it replaced some digits of the mobile numbers with star character (*). The amount of characters it replaced is fixed for all numbers though. Now the client came to us for help and asked us to provide a way to get back the original numbers with the status of delivery. We told the client that the recovery may not be 100% accurate and client is happy with that if we can recover the majority of the numbers and can indicate for which numbers we are confused. Client will provide us his original mobile number list to which he sent the campaign and will provide the delivery report where he has the stared out mobile numbers along with the status of delivery. You have to create two lists, one for the successfully delivered numbers and the other for failed numbers. In case you are unable to predict the number because there are multiple possibilities, you have to print “Confused” for those numbers. You can assume that the two lists client provided will have same amount of numbers and can assume the original number list had all unique numbers. Input: ------ Input starts with an integer **T (≤ 10)**, denoting the number of test cases. The each **T** test cases next, there will be a positive integer **X (<=100)** in a line which denotes the amount of mobile numbers in original list and in the delivery report. Then there will be **X** lines each having the original mobile numbers. After this there will be another **X** lines each having the stared out mobile number and status of delivery separated by comma (,). The status values are “Success” and “Failed” without the quotation marks. Each test case will be separated by a blank line. Remember for all test cases 4th to 7th digits in the mobile number will be stared out. Mobile numbers considered to have digits only. It should not have any dash (-) or space in between. But do not predict it to be Bangladeshi mobile number always. It can have length of 10 to 20 and when not stared it will only have digits. Output: ------- For each test case, print the case number as: “**Case: C**” where **C** denotes the test case sequence number in a line. Then print a line: “Success list” without quotation marks. Then print each mobile numbers which was in status “Success” as “**SN : ON**” without quotation (SN denotes stared out number, ON denotes original number). Then print a line “Failed list” without quotation marks and it follows the mobile numbers which was in status “Failed” as “SN : ON” without quotation (SN, ON denotes same as above). If any number is uniquely unpredictable (because, stared out number match multiple original numbers) then print “SN : Confused” without quotation. You should output these lists according to the order in which you have taken the delivery report (stared out number list) as input as it will help the client to compare our output with his delivery report to verify your conversion. Please check the sample input output for further clarification about input / output format. Sample Input ------------ 3 5 01717171717 01818181818 01919191919 01616161616 01111111111 016****1616,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success 5 01717171717 01818181818 01919191919 01919191918 01111111111 019****1918,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success 5 01717171717 01818181818 01919191919 01918191919 01111111111 019****1919,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success Sample Output ------------- Case: 1 Success list 016****1616 : 01616161616 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : 01919191919 Case: 2 Success list 019****1918 : 01919191918 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : 01919191919 Case: 3 Success list 019****1919 : Confused 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : Confused


Problem Setter:

MD. Jalal Uddin

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# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

26/126

Solve/Submission

Ranking

# User Language Timing
01 afzalul Cpp14 0.00s
02 mrinmoi Cpp 0.00s
03 feodorv C 0.00s
04 rithu Cpp14 0.00s
05 Ehsanul_Fahad Cpp 0.01s
06 khmahbub20 Cpp 0.01s
07 sadia2427 Cpp14 0.01s
08 smriad Cpp14 0.01s
09 rashedul007 Cpp 0.01s
10 ash12 Cpp14 0.01s
11 haasib Cpp14 0.01s
12 Masum_ice Cpp14 0.02s
13 RandyWaterhouse Python3 0.06s
14 mahbub07 Cpp14 0.27s
15 ranit Cpp14 0.39s
16 froghramar Cpp14 0.41s
17 shailyroy Cpp14 0.45s
18 moshiur_cse15 Cpp14 0.54s
19 zyyxxx Cpp14 0.55s
20 Ishrak Cpp14 0.56s
21 njrafi Cpp14 0.56s
22 isat1729 Cpp14 0.57s
23 tariqiitju Cpp14 0.60s
24 ProKawsar Cpp14 0.62s
25 amit_bd Java 1.92s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support