Map Operations
Basic Accuracy: 43.16% Submissions: 2389 Points: 1

You are given an array A of size N. you need to insert the elements of A into a map(element as key and index as value) and display the results. Also, you need to erase a given element x from the map and print "erased x" if successfully erased, else print "not found".

Input Format:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains three lines of input. The first line contains N denoting the size of the array A. The second line contains N elements of the array. The third line contains element x that need to be erased from the set.

Output Format:
For each testcase, in a new line, print the required output.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided functions.

Constraints:
1 <= T <= 100
1 <= N <= 1000
1 <= Ai <= 106

Examples:
Input:

1
10
9 8 7 4 4 2 1 1 9 8
1
Output:

1 7
2 5
4 4
7 2
8 9
9 8
erased 1
2 5
4 4
7 2
8 9
9 8

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.