Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing calculation needs to be conservative #220

Open
rokicki opened this issue Feb 19, 2023 · 3 comments
Open

Timing calculation needs to be conservative #220

rokicki opened this issue Feb 19, 2023 · 3 comments

Comments

@rokicki
Copy link

rokicki commented Feb 19, 2023

I have one problem where slowest AC is 0.94, and time multiplier is 1.5.

Verifyproblem (and presumably Kattis as well) does the calculation as follows:

round(0.94 * 1.5 + 0.5) => 1s

(See https://github.com/Kattis/problemtools/blob/develop/problemtools/verifyproblem.py#L1400).

giving a 1s time limit. This is much too close to the slowest AC. I propose the actual
algorithm should be:

ceil(0.94 * 1.5) => 2s

This would have the effect of adding an everage of 0.5s to all time limits, but it would
resolve this important corner case.

@meisterT
Copy link
Contributor

Does Kattis support non integer time limits?

@simonlindholm
Copy link
Member

Rather than ceil I guess the mathematically correct thing to do would be to round geometrically, i.e. to whichever one of floor(0.94 * 1.5) and ceil(0.94 * 1.5) is closest after taking logs.

Kattis does not support non-integer time limits, unfortunately.

@rokicki
Copy link
Author

rokicki commented Feb 20, 2023

That seems unnecessarily complex and unintuitive. And it wouldn't even help in this case; it would still round to 1s, which is too close to the worst AC of 0.94 to be reasonable. (log(0.94 * 1.5/1) = .1492; log(2/(0.94 * 1.5)) = 0.1518; this algorithm would choose 1s.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants