re求救

P3379 【模板】最近公共祖先(LCA)

要不您把头文件换bits/stdc++.h试试?
by moye到碗里来 @ 2018-02-09 17:00:09


您的edge数组开大了: N<<1+5改为(N<<5)+1(这样同样可能会炸,因为数组过大) ``` noilinux@ubuntu:~/Desktop$ g++ x.cpp -g -Wall -Wextra x.cpp:12:8: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses] }edge[N<<1+5]; ^ x.cpp:16:12: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses] }question[N<<1+5]; ^ x.cpp: In function ‘void addquestion(int, int)’: x.cpp:29:43: warning: missing initializer for member ‘Question::LCA’ [-Wmissing-field-initializers] question[++cntQ]=(Question){headq[u],v},headq[u]=cntQ; ^ x.cpp:30:43: warning: missing initializer for member ‘Question::LCA’ [-Wmissing-field-initializers] question[++cntQ]=(Question){headq[v],u},headq[v]=cntQ; ^ ```
by Creeper_LKF @ 2018-02-09 17:04:37


@[ezoiHY](/space/show?uid=48146)
by Creeper_LKF @ 2018-02-09 17:05:05


@[Creeper_LKF](/space/show?uid=43464) 难道不是(N<<1)+5 吗
by qwqKanade @ 2018-02-09 17:09:51


orz @[ezoiHY](/space/show?uid=48146)
by ezoixx130 @ 2018-02-09 17:12:52


@[ezoiHY](/space/show?uid=48146) 你位运算要加括号 例如(N<<1)+5 因为位运算符优先级小于+-×/
by star_magic_young @ 2018-02-09 17:22:12


谢谢
by ezoiHY @ 2018-02-10 08:53:10


@[ezoixx130](/space/show?uid=34886) 膜拜啊
by ezoiHY @ 2018-02-10 08:53:48


|