哈希表(csp-s模拟测试53 v)
struct map_hash{ struct node{ int to,n;double val;int len;}e[31000001]; int tot=0; int head[MAXN];int len=0; double &operator[](int state){ int st=state*len%mod+1; for(int i=head[st];i;i=e[i].n){ if(e[i].to==state&&e[i].len==len) return e[i].val; } e[++tot].to=state; e[tot].val=-1.0; e[tot].len=len; e[tot].n=head[st]; head[st]=tot; return e[tot].val; }}f;
二元组加和和比较大小
struct node{ int fir;int sec; friend node operator +(node a,node b){ return (node){a.fir+b.fir,a.sec+b.sec}; }};inline node minn(node a,node b){ if(a.fir==b.fir)return a.sec