foo.cc: In function 'int main()':
foo.cc:79:16: warning: iteration 5000 invokes undefined behavior [-Waggressive-loop-optimizations]
79 | head[i]=-1;
| ~~~~~~~^~~
foo.cc:78:20: note: within this loop
78 | for (int i=1; i<=5001; i++) {
| ~^~~~~~
foo.cc:79:16: warning: 'void* __builtin_memset(void*, int, long unsigned int)' forming offset [40008, 40015] is out of the bounds [0, 40008] of object 'head' with type 'long long int [5001]' [-Warray-bounds]
79 | head[i]=-1;
| ~~~~~~~^~~
foo.cc:20:5: note: 'head' declared here
20 | int head[5001];
| ^~~~
[Hydro](https://hydro.ac)提供评测服务