DCP-80: You don’t use Lacebook? So backdated! Back to All Problems

Easy Beginners Problems > Ad-hoc

Lacebook, a social network, has recently changed their policy. From now on, a user can not remove any friend from his friend-list. But they have forgotten, that is to remove the remove button. In Lacebook, the friend-list of a user is represented as a list. Each friend is an item of the list. Each item has a corresponding “remove” button. Whenever a user click on that button, the item is removed from the list and then added at the end of the list. Thus the items of the list remain unchanged, only the the changes. Now, you are given two friend-lists containing same items. But the order of the items may vary. Can you make the first list look exactly like the second one using only the remove buttons? Input: ------ Input starts with a positive integer **T(<= 100)**, denoting the number of test cases. The first line of a test case contains a positive integer **N(<= 10000)**, denoting the number of item in a list. Then there will be two lines. The first of the two lines will contain N positive integers denoting the first list. And the second line will also contain N positive integers denoting the second list. A list will always contain unique items. No list will be empty. Output: ------- For each case, print the case number and the minimum number of click required to convert the first list into the second one Sample Input ------------ 2 1 1 1 3 1 2 3 3 2 1 Sample Output ------------- Case 1: 0 Case 2: 2

Problem Setter:

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




# User Language Timing
01 feodorv C 0.04s
02 souravahmed C 0.09s
03 mhmbd CSharp 0.17s
04 Morass Cpp14 0.18s
05 Robbinb1993 Cpp14 0.24s
06 tariqiitju Cpp14 0.25s
07 abinash Cpp14 0.32s
08 mamun4122 Cpp14 0.34s
09 abuasifkhan Cpp14 0.38s
10 imranziad Cpp14 0.43s
11 sahedsohel Cpp14 0.45s
12 dipta007 Cpp14 0.46s
13 Matrix_code Cpp14 0.54s
14 akazad_cse13_ruet Cpp14 0.54s
15 faisal47 Cpp14 0.55s
16 anowar1112 Cpp14 0.56s
17 ssavi Cpp14 0.56s
18 ksohan Cpp14 0.56s
19 Roll_Number_27 Cpp14 0.57s
20 KIRIN_36 Cpp14 0.64s
21 showmic Cpp14 0.65s
22 mamun Cpp14 0.66s
23 ddevilred1 Cpp14 0.66s
24 raihatneloy Cpp14 0.72s
25 khatribiru Cpp14 0.72s
26 sohelcseiu Cpp14 0.76s
27 mahbubcseju Cpp14 0.76s
28 SleepyBrain Cpp14 0.77s
29 Jobayer__ Cpp14 0.81s
30 habib_rahman Cpp14 0.84s
31 nfssdq Cpp14 0.87s
32 Foyaz05 Cpp14 0.88s
33 moinul_shaon Cpp14 1.00s
34 Jumba Cpp14 1.09s

Your feedback is our precious!

Or call +88 02 9853138 for support