冲您这名字就要%%%
by 花园Serena @ 2019-02-05 16:12:04
@[Van♂様年华](/space/show?uid=86973)
都是同♂志
by Dark_Van @ 2019-02-05 18:50:52
邻接表开大 你邻接表大小就10010 我之前开到100010都re 开到1000010就好了
by arr2 @ 2019-02-17 08:47:10
@[Dark_Van](/space/show?uid=112720) 我原本也是这样,开了$5e6$都过不去,后来发现图中有很多的重边(最坏约$n^2m$条,甚至超$1e8$),所以要再开一个二维数组判重边
before:
```cpp
#define maxn 2011
#define maxm 5000011
ll n,m;
struct Edge
{
ll v,nxt;
}e[maxm];
ll cnt=0,last[maxn],ind[maxn];
void adde(ll u,ll v)
{
++ind[v];
e[++cnt].v=v;
e[cnt].nxt=last[u];last[u]=cnt;
}
```
after:
```cpp
#define maxn 2011
#define maxm 2000011
ll n,m;
struct Edge
{
ll v,nxt;
}e[maxm];
ll cnt=0,last[maxn],ind[maxn];
bool p[maxn][maxn];
inline void adde(ll u,ll v)
{
if(p[u][v])return;
p[u][v]=1;
++ind[v];
e[++cnt].v=v;
e[cnt].nxt=last[u];last[u]=cnt;
}
```
PS:要稍微卡一下常,否则T一个点
by 万弘 @ 2019-04-21 13:03:42