Can this problem be solved using Binary Search
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
Can this problem be solved using Binary Search
Название |
---|
NO. First test case, 100 can be represented with 1 banknote. And so does 1. Basically, you cannot compare it to the final answer.
What do u mean by final answer
For each test case, print one integer — the minimum positive number of burles s that cannot be represented with k or fewer banknotes.
You can use binary search in the array a so that you can say that the cost(10^b) = 10^(b-last) where last is the last ai such that ai <= b and use this to solve the problem(this is quite useless since n = 10 but actually optimize it 157598538), otherways I don't where to use binary search. If you meant binary search the answer, it is not possible since the cost(x) does not strictly increment, in a case like a: {0, 4} cost(10000) = 1, cost(9999) = 9999.
No. Binary search requires the searchspace to have a special property. If it can be done for some value x then it can be done also for x+1 and it's enough.
(The direction can be reversed, ie x -> x-1).
This problem clearly doesn't satisfy this.