#BS0000004. Viên bi ở đâu? (Where is the Marble?)
Viên bi ở đâu? (Where is the Marble?)
Where is the Marble?
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are marbles. Each marble has a non-negative integer written on it. The marbles are initially unsorted.
Sort the marbles in increasing order. After sorting, positions are numbered from to .
For each of query values :
- if occurs, find its first position in the sorted sequence;
- otherwise report that it was not found.
Input
The first line contains and .
The second line contains the marble values.
The third line contains query values.
Output
First print:
CASE# 1:
For each query , print either:
x found at y
where is the first 1-based position of , or:
x not found
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , every input value is in .
Examples
Input
5 2
1 3 3 3 1
2 3
Output
CASE# 1:
2 not found
3 found at 3
Explanation
After sorting, the sequence is . The value is absent, while the first is at 1-based position .