Make a direct contribution to a pseudo-hash, hash dafa good, hash a miracle
However, this is not a long time no brush problem, WA a lot of hair, Orz
#include <cstdio> #include <cstring> #include <algorithm> #include <map>using namespace std;# Define UL unsigned long longconst UL mod=1000000009;const ul modx=100000007;const int maxn=2008;struct fuck{int U,left,rig HT;} Edge[maxn];int tol;void init () {tol=0;} UL mody;void fuckbitch (int x) {edge[tol].u=x;edge[tol].left=-1;edge[tol].right=-1;tol++;} BOOL Dfs (int u,int x) {if (u==-1) {fuckbitch (x); return true;} if (edge[u].u>x) {if (Dfs (edge[u].left,x)) edge[u].left=tol-1;} Else{if (Dfs (edge[u].right,x)) edge[u].right=tol-1;} return false;} map<ul,int> mp;void Fuckdfs (int u,ul md) {mody=mody*modx+md;if (edge[u].left!=-1) Fuckdfs (Edge[u].left, (md< <1)); if (edge[u].right!=-1) Fuckdfs (Edge[u].right, (md<<1|1));} int main () {int t,i,j,x;int n,m;scanf ("%d%d", &n,&m); int sum=n;mp.clear (); for (i=1;i<=n;i++) {mody=0;init () ; for (j=1;j<=m;j++) {scanf ("%d", &x), if (j==1) fuckbitch (x); Elsedfs (0,x);} Fuckdfs (0,1); UL ans=mody;if (mp[ans]==0) mp[ans]++;elsesum--;} printf ("%d\n", sum); reTurn 0; }
ICPC World Finals-ceiling Function