foo.cc: In function 'int work2()':
foo.cc:18:20: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
18 | int ans=(1<<31)-1;
| ~~~~~~~^~
In file included from /nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/algorithm:61,
from foo.cc:2:
In function 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]',
inlined from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' at /nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/bits/stl_algo.h:1844:5,
inlined from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' at /nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/bits/stl_algo.h:1940:31,
inlined from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' at /nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/bits/stl_algo.h:1932:5,
inlined from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int*]' at /nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/bits/stl_algo.h:4820:18,
inlined from 'int main()' at foo.cc:45:13:
/nix/store/az0d9jnqsm8g8nbc8n61w9y2x1lmdspk-gcc/include/c++/12.2.0/bits/stl_algo.h:1849:32: warning: array subscript 17 is outside array bounds of 'int [15]' [-Warray-bounds]
1849 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:5:5: note: at offset 68 into object 'a' of size 60
5 | int a[15];
| ^
[Hydro](https://hydro.ac)提供评测服务