当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
Fatigued by the endless toils of farming, Farmer John has decided to try his hand in the MP3 player market with the new iCow. It is an MP3 player that stores N songs (1 ≤ N ≤ 1,000) indexed 1 through N that plays songs in a "shuffled" order, as determined by Farmer John's own algorithm:
Determine the first T songs (1 ≤ T ≤ 1000) that are played by the iCow.
* Line 1: Two space-separated integers: N and T
* Lines 2..N+1: Line i+1 contains a single integer: Ri
* Lines 1..T: Line i contains a single integer that is the i-th song that the iCow plays.
3 4 10 8 11
3 1 2 3
时间上限 | 内存上限 |
1000 | 65536 |