I solved it using sorting + dp. In tags it is 'binary search' + 'sorting'. Couldn't think of binary search solution.
BTW, size limit is 10^6 and not 10^5.
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
8 | awoo | 154 |
10 | luogu_official | 150 |
Name |
---|
First of all I think it will be better to write to link and not only problem name (maybe I'm wrong, but I do not know how to search problems by name).
Here is the link (I think you are talking about): 101C Queue.
Maybe I'm looking on different problem, but tags I see are: "constructive algorithms", "greedy", "sortings" and limit (for h_i) in this problem is 10^9.
Ok, my bad.
this is the problem : Queue
For each position on the queue calculate the youngest person from that position to the end. You can do binary search to find the farthest place on the queue such that this min is less than the age of the current walrus, which is the position of the farthest walrus that is younger than the i-th one.
Thanks for that.