№ | Пользователь | Рейтинг |
---|---|---|
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 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Название |
---|
Since that line of code rejects any probabilities <= to your specified value, it may cause an incremental error that causes the final answer to differ from the machine answer by 1e-6. The error seems to be large enough in the 1e-9 case for that to occur.
Btw, you don't need to reject any probabilities, since the number of possible cases is small enough for a brute force solution.
Since both the values are in the safe epsilon range of 1e-6 and lower (as specified by the author), if values lower than or equal to 1e-9 led to incremental errors, shouldn't the use of an epsilon greater than 1e-9 also possibly lead to incremental errors?
I am a total novice and error management at this level seems a bit fuzzy and arbitrary.
My eps for all the statements other than the first one is 1e-7 for both the codes (9 and 10).
I just ran your code with 1e-7 and it doesn't seem to work. 1e-7
No, I meant that I am using 1e-7 as the actual eps for both the codes (1e-9 and 1e-10). In both the submissions, I am using 1e-7 in the part below the statement. it is the choice of epsilon (1e-9 and 1e-10) for the first statement that completely changes the answer.
So, if incremental errors at the level of 1e-9 sometimes lead to a change in the answer, how is it that an epsilon of 1e-7 or even 1e-6 is able to work?
Oh, ok. Sorry for misunderstanding. The epsilon used in the part below is necessary because you are comparing whether c or m values are equal to v. Because of floating point error, situations may arise where you have c — min(v, c) = 1e-16 instead of 0 and create a false positive. So that epsilon (which can be between 1e-6 to 1e-12) is needed to perform the equality operation, which does not contribute to the final answer.
The first statement, however, causes an incremental error because it outright rejects some probabilities, which is incorrect. There are many sequences that have probability < 1e-9 due to their length, and these cumulatively added up to an error over 1e-6.