oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

buycomputer Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

statement.html

Problem Description

Hearing that a faster computer will allow you to compile code faster, Takahashi decides to buy a new computer to increase his AtCoder ranking.

Takahashi has a list of N computers that he is considering to buy. The i-th computer has a price Pi yen (the currency of Japan) and is arranged such that the computers are sorted in decreasing order of how much Takahashi prefers it.

Takahashi has Q queries. In the i-th query, he wants to know what the best computer he can buy with Mi yen is. So print out the index of that computer. If he cannot buy any of the computers, print -1.

Input

The first line of input will contain two integers, N and Q.

The next line of input will contain N space-seperated integers, P1, P2 ... PN.

The following line of input will contain Q space-seperated integers, M1, M2 ... MQ.

Output

The output should contain a single line of Q space-seperated integers, answering each query.

Limits

For all subtasks: 1 ≤ N,Q ≤ 100000, 1 ≤ Pi,Mi ≤ 1018

Subtask 1 (25%): N,Q ≤ 1000.

Subtask 2 (75%): No additional constraints.

Subtask 3 (0%): Sample test cases.

Sample Input

5 7
9 4 6 3 2
3 1 4 1 5 9 2

Sample Output

4 -1 2 -1 2 1 5

Tags

Data Structure

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
125120.2s16MBMinimum
275220.2s16MBMinimum
3010.2s16MBMinimum

Judge Compile Command

g++-8 ans.cpp -o buycomputer -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.