主页 讨论版 问题 名次 状态 统计

请自觉遵守比赛规则,违者严惩,不接受求情!

问题 F: Fighting Orz Pandas

问题 F: Fighting Orz Pandas

时间限制:1000 ms 内存限制:128 MB
提交:90 解决:24
[ 提交][ 状态][ 讨论版]

题目描述

There are many Orz pandas in the QQ group ACM_XDU-ICPC, each panda have a value IQ, they are all aggressive, An srO panda Ai will beat a Orz panda fixed the follow conditions: Have a smallest IQ among all the pandas whose IQ is higher than or equal to Ai.
There are N Orz pandas numbered from 1 to N (N<=100000) in the QQ group ACM_XDU-ICPC. Today M srO pandas (M<=100000) push into this group, please output the id of Orz pandas who will beaten by Mi srO paddas. If there are multi answer output the minimum id one. No answer output -1.(id is index of input of Orz Pandas. start from 1)

输入

Input
Several test cases, process to EOF
First line two number N and M.
Next N lines there are a number in each line. Stand for IQ of Ni Orz panda.
Next M lines there are a number in each line. Stand for IQ of Mi srO panda.

输出

For each case, output M numbers in a line. The number of Orz panda who will beaten by Mi srO

样例输入

3 4 1 2 3 1 2 3 4

样例输出

1 2 3 -1

提示

[ 提交][ 状态][ 讨论版]
Baidu
map