foo.cc: In function 'int main()':
foo.cc:64:44: warning: iteration 1004 invokes undefined behavior [-Waggressive-loop-optimizations]
64 | for(int i = 1;i <= N;i ++) head[i] = -1;
| ~~~~~~~~^~~~
foo.cc:64:25: note: within this loop
64 | for(int i = 1;i <= N;i ++) head[i] = -1;
| ~~^~~~
foo.cc:65:42: warning: iteration 1004 invokes undefined behavior [-Waggressive-loop-optimizations]
65 | for(int i = 1;i <= N;i ++) fa[i] = i;
| ~~~~~~^~~
foo.cc:65:25: note: within this loop
65 | for(int i = 1;i <= N;i ++) fa[i] = i;
| ~~^~~~
foo.cc:64:44: warning: 'void* __builtin_memset(void*, int, long unsigned int)' forming offset [4020, 4023] is out of the bounds [0, 4020] of object 'head' with type 'int [1005]' [-Warray-bounds]
64 | for(int i = 1;i <= N;i ++) head[i] = -1;
| ~~~~~~~~^~~~
foo.cc:15:13: note: 'head' declared here
15 | int fa[N] , head[N] , cnt;
| ^~~~
[Hydro](https://hydro.ac)提供评测服务