We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Apparently the suffix array is a bit slow and has resulted in TLEs.
One suggestion that came up in the AC discord server (https://discord.com/channels/555883512952258563/559415184826040340/809806400070483989) is splitting
for (int i = n; i--;) sa[--ws[x[y[i]]]] = y[i];
into multiple loops, e.g.
for (int i = n; i--;) tmp[i] = x[y[i]]; for (int i = n; i--;) tmp[i] = --ws[tmp[i]]; for (int i = n; i--;) sa[tmp[i]] = y[i];
which seems to help on random data. It's not obvious why, but I'm speculating that it's due to load mispredictions.
The suffix array seems to perform worse on repetitive data though (e.g. s[i] = i % 10), and the change makes performance worse in that case. :(
The text was updated successfully, but these errors were encountered:
I'm also having trouble with this implementation; it is too slow to pass several CSES problems, such as https://cses.fi/problemset/task/1111/ or https://cses.fi/problemset/task/1110.
Sorry, something went wrong.
No branches or pull requests
Apparently the suffix array is a bit slow and has resulted in TLEs.
One suggestion that came up in the AC discord server (https://discord.com/channels/555883512952258563/559415184826040340/809806400070483989) is splitting
into multiple loops, e.g.
which seems to help on random data. It's not obvious why, but I'm speculating that it's due to load mispredictions.
The suffix array seems to perform worse on repetitive data though (e.g. s[i] = i % 10), and the change makes performance worse in that case. :(
The text was updated successfully, but these errors were encountered: