Skip to content

Instantly share code, notes, and snippets.

@wiwiho
Last active November 13, 2021 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiwiho/c41eca6f5976b4c620b41225ab466753 to your computer and use it in GitHub Desktop.
Save wiwiho/c41eca6f5976b4c620b41225ab466753 to your computer and use it in GitHub Desktop.
set<int> f(int n, int k, vector<ll> seed){
set<int> s;
for(int i = 0; s.size() < k; i++){
ll tmp = 47 * seed[0] + 75 * seed[1] + 33 * seed[2] + 87 * seed[3] + 123 * seed[4];
tmp ^= (i * 48763) * (i << 1);
tmp %= n;
for(int j = 3; j >= 0; j--) seed[j] = seed[j + 1];
seed[4] = tmp;
s.insert(tmp % n);
}
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment