如果你这么写
const int inf=1<<31;
就会死循环,因为int有符号位,应该是
const unsigned int inf=1<<31;
或者
const long long inf=1e15+7;