其他-手工哈希映射

struct ghs {
private:
	static const int A = 999917, B = 1e7;
	ll v[B];
	int fst[A], nxt[B], w[B], s[B], top, cnt;
	
	int ins(int x, ll y)
	{
		if (!fst[x]) s[++top] = x;
		nxt[++cnt] = fst[x], fst[x] = cnt;
		v[cnt] = y;
		return w[cnt] = 0;
	}
	
	void clear()
	{
		cnt = 0;
		while (top)
			fst[s[top--]] = 0;
		return;
	}

public:
	int &operator [] (ll x)
	const
	{
		int t = x % A;
		for (int i = fst[t]; i; i = nxt[i])
			if (v[i] == x) return w[x];
		return ins(t, x);
	}
};

Really don't like that Old–fashioned 'au' sound, and the tune is bit of weird i think (as if she's choking). And btw, officially no British dialects have the glotal T sound (like wa'er) except for Cockney, which is far away from modern RP and considered unstandard. You speak with modern RP to show your intelligence and how well you have been educated, of course. But i just can't stop associating this with an old weather forecaster...

原文地址:https://www.cnblogs.com/ghcred/p/9839786.html