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

Adaptive checker (to handle float precision error) #72

Open
mfornet opened this issue May 10, 2020 · 2 comments
Open

Adaptive checker (to handle float precision error) #72

mfornet opened this issue May 10, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@mfornet
Copy link
Owner

mfornet commented May 10, 2020

Default checker used atm is wcmp which is great to compare tokens and ignore trailing whitespaces and EOL (also similar checkers are commonly used on several platforms, primarily Codeforces).

But another common checker is using decimal numbers and allowing some margin for mistake (1e-7).

Proposoal: Use an hybrid of wcmp where if token comparation fails, try to read both token as doubles and check whether precision is below some threshold. This idea rarely will give some false positive, and will automatically work for test cases that requires a decimal number where some error is allowed.

@Salil03
Copy link
Collaborator

Salil03 commented May 10, 2020

Wouldn't this be very slow?

@mfornet
Copy link
Owner Author

mfornet commented May 11, 2020

Wouldn't this be very slow?

Why do you think that would be the case? The idea is that for every token we compare if they are equal, if that check fails, then we try to convert to double and check if both are at most some epsilon apart from each other, if it fails to convert to double or they are not that close, then we finish checker and report Wrong Answer.

I propose to use same code from wcmp but adding this one more check. I don't think it will create any noticeable overhead.

@mfornet mfornet added the enhancement New feature or request label May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants