Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

为啥我都用了cin,cout怎么还是超时啊？？？？

Posted by zsc08_wangqiang at 2010-08-24 20:02:57 on Problem 1274
```#include<iostream>
using namespace std;
const int maxn = 201;
const int maxm = 201;

struct gtype
{
int x, y, next;
};
gtype g[maxm];
int first[maxn];
bool used[maxn];
int n, m, tot;

{
tot++;
g[tot].x = x;
g[tot].y = y;
g[tot].next = first[x];
first[x] = tot;
}
bool find(int s)
{
int temp;
temp = first[s];
while(temp != -1)
{
if( !used[g[temp].y])
{
used[g[temp].y] = true;
{
return true;
}
}
temp = g[temp].next;
}
return false;
}
int main()
{
int i, j, k, x, y;
int ans;
while(cin>>n>>m)
{
for(x=1; x<=n; x++)
{
cin>>k;
for(j=1; j<=k; j++)
{
cin>>y;
}
}
for(i=1; i<=n; i++)
{
memset(used, false, sizeof(used));
find(i);
}
ans = 0;
for(i=1; i<=n; i++)
{
{
ans++;
}
}
//printf("%d\n",ans);
cout<<ans<<endl;
}
return 0;
}```

Followed by: