Trie树。
题意是问某个数字可不可能是其他数字的前缀。
就是裸的字典树。排序然后插进去就好了。
#include #include #include #include #include #include #include #include #include #include #include #define INF 0x7fffffff #define eps 1e-6 #define LL long long using namespace std; struct Trie { int word[100001][10]; int sz,cot; int ex[1000010]; void intTrie() { sz=1; cot=1; memset(word[0],0,sizeof(word[0])); ex[0]=0; } int insert(char *s) { int u=0,c,len=strlen(s); int ans=0; for(int i=0; i 0) { flag=1;break; } } if(flag)puts("NO"); else puts("YES"); } }