Notes
This function is in beta test. Please help improve it in the issues
here.
/in/ex3.cpp:12:9: runtime error: index 25000 out of bounds for type 'int [25000]' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /in/ex3.cpp:12:9 in ================================================================= ==38950==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd3bda6360 at pc 0x00000051dbe5 bp 0x7ffd3bba5070 sp 0x7ffd3bba5068 WRITE of size 4 at 0x7ffd3bda6360 thread T0 #0 0x51dbe4 (/out/package/ex3+0x51dbe4) #1 0x51adea (/out/package/ex3+0x51adea) #2 0x7f67a7190b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x41e1d9 (/out/package/ex3+0x41e1d9) Address 0x7ffd3bda6360 is located in stack of thread T0 at offset 2101824 in frame #0 0x51b86f (/out/package/ex3+0x51b86f) This frame has 9 object(s): [32, 33) '__c.addr.i146' [48, 49) '__c.addr.i142' [64, 65) '__c.addr.i' [80, 600) 'f1' [736, 1248) 'f2' [1312, 1001312) 'arr1' [1001568, 2001568) 'arr2' [2001824, 2101824) 'temp' <== Memory access at offset 2101824 overflows
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
-32 65 26 -39 -2 59 -35 -111 128 16 -31 63 -57 72 100 -16 31 70 170 80 9 -66 -147 -52 -88 -19 122 134 100 -38 34 -159 -96 47 40 -19 5 -72 25 -58 -61 -130 91 107 -51 85 65 95 -42 46 -56 -57 82 -75 74 9 75 -17 60 25 104 -134 10 70 63 -138 115 82 15 73 -42 103 -25 -76 -42 -144 13 14 -50 59 -96 89 -107 62 105 -48 -79 36 -133 -86 -90 72 74 -36 0 36 29 -116 32 -60 -41 -104 -70 56 59 31 10 -42 -121 54 24 -96 20 91 142 144 -8 25 57 -39 -14 -7 32 -139 -14 36 80 -132 8 -122 73 181 88 36 -13 143 -13 62 -123 -37 37 -76 -6 -54 115 116 -176 85 -40 -98 67 -39 14 95 -47 -5 1 -34 75 19 -163 -109 -17 -3 74 126 -119 58 80 -80 75 -120 -50 161 -42 3 -53 149 112 69 -115 112 -43 -1 34 46 126 -88 -31 98 -19 161 -51 -127 53 -88 21 79 20 60 74 107 20 68 6 -61 97 -50 46 -6 -27 -23 -8 108 -37 -77 -12 41 23 -152 41 123 -81 -3 58 35 -56 60 30 113 -36 -63 -60 1 -10 -145 6 21 -106 12 64 90 -148 -46 -125 -40 -80 84 169 0 -52 -88 24 -97 23 29 -19 -66 44 15 80 -96 40 -107 44 -113 7 96 -9 56 93 -15 72 -131 101 -110 57 -25 141 -110 38 60 1 124 -