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

2018 ICPC Asia Singapore Regional Contest/F.cpp counter example #3

Open
saobangmath opened this issue Nov 2, 2021 · 3 comments
Open

Comments

@saobangmath
Copy link

saobangmath commented Nov 2, 2021

Hi Luqman, I feel like for the problem F of the Singapore ICPC Regional 2018, the solution in your repo is not correct for this test case:

7
3 4 3 4 5 3 5

The answer should be 3 4 while your F solution return 3 5.
I am looking forward to your response and thank you so much!

@luqmanarifin
Copy link
Owner

Where can I get problemset for this that I can check on? It's long time ago and I forget how I did it back then at that time @saobangmath

@saobangmath
Copy link
Author

Dear Luqman, here is the problem that I am referring to:
https://open.kattis.com/problems/wiknow

Your solution is here: https://github.com/luqmanarifin/cp/blob/master/2018%20ICPC%20Asia%20Singapore%20Regional%20Contest/f.cpp

@saobangmath
Copy link
Author

My suggestion to fix is this line:
if (kanan[data[i]] == -1) kanan[data[i]] = i;
the kanan[data[i]] should be updated to the nearest i position so far instead of the rightMost one. So regardless of the initial value of kanan[data[i]], it should always be updated to i.

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

2 participants