Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Querry Q[max_sz];
- ll key[MOD];
- int val[MOD];
- struct hsh_table {
- ll k;
- void add(ll pos, int value) {
- for (k = pos % MOD; k < MOD; k++) {
- if (key[k] == 0) {
- key[k] = pos;
- val[k] = value;
- break;
- }
- }
- }
- int que(ll pos) {
- for (k = pos % MOD; k < MOD; k++) {
- if (key[k] == 0) {
- return 0;
- }
- if (key[k] == pos) {
- return val[k];
- }
- }
- return 0;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement