Hi ! Let's discuss Croatian Open Competition in Informatics (COCI) Round 6 here . http://hsin.hr/coci/.
How to solve problem Sličice (Dynamic Programming or Greedy ) and Simfonija (Segment Tree ) ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
2 | maomao90 | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Hi ! Let's discuss Croatian Open Competition in Informatics (COCI) Round 6 here . http://hsin.hr/coci/.
How to solve problem Sličice (Dynamic Programming or Greedy ) and Simfonija (Segment Tree ) ?
Название |
---|
dp[i] = maximal profit you can gain by taking i extras
code
thanks very much ! :)
For Simfonija, notice that the n - k smallest values of |(Ai + X) - Bi| will always be a contiguous subarray of the sorted Ai - Bi array. As X increases, that subarray moves from the highest Ai - Bi to the lowest. So simply loop over all values of X, move the subarray boundaries if necessary and calculate the sum using prefix sums.
oh ,really . very interesting to know that. Thanks very much ! :)
You can solve all problems here: https://oj.uz/problems/source/374
I would like to know the solution to task E(Mobitel).
Any help would be much appreciated.
The dynamic programming solution O(RSN) is straight-forward, the states are:
For each cell and each n <= N-1, how many path exist that finish in this cell whose product is exactly n).
The trick is to change the states to:
For each cell and each k, how many paths exist that finish in this cell and such that k is the largest integer number we can multiply in the remaining part of the path without reaching N?
Instead of keeping the value of the product until the current cell, we keep how much the product can be from here to the end. The crucial difference is that the only interesting values of k are for 1 ≤ i ≤ N (prove it). Hence the solution is .
My this code takes runtime error in mobitel please help me. https://paste.ubuntu.com/p/txXDR6G8wG/