1.用memset的时候注意数组不能开太大,否则会超时
2.0x3f3f3f3f的值是1061109567
#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
int n,m,a[510],e[1010][1010],cnt,num;
string s;
int main()
{
freopen("Travel.in","r",stdin);
freopen("Travel.out","w",stdout);
memset(e,0x3f3f3f3f,sizeof e);
scanf("%d%d\n",&m,&n);
for(int t=1;t<=m;t++)
{
cnt=0;
getline(cin,s);
for(int i=0;i<s.size();i++)
{
num=0;
while(s[i]>='0'&&s[i]<='9')
{
num=num*10+s[i]-'0';
i++;
}
a[++cnt]=num;
}
for(int i=1;i<=cnt;i++)
{
e[i][i]=0;
for(int j=i+1;j<=cnt;j++)
{
e[a[i]][a[j]]=1;