Notes
This function is in beta test. Please help improve it in the issues
here.
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Time Exceeded. And the exit code of your program is -9, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
0 2 10465 0 3 8762 0 4 1442 0 5 9874 0 6 5104 0 8 9648 0 9 5024 0 10 1366 0 11 -3 0 12 10278 0 13 3514 0 14 4747 0 18 1420 0 19 9753 0 21 6753 0 23 2618 0 24 3673 0 25 -1 0 26 2229 0 27 2391 0 28 5216 0 30 3813 0 31 2040 0 32 7276 0 33 8796 0 34 7053 0 35 2701 0 36 3986 0 37 10522 0 39 3732 0 40 5467 0 41 3830 0 42 6085 0 43 6529 0 44 8465 0 45 6487 0 46 9638 0 47 1396 0 48 6613 0 49 1160 0 50 2839 0 51 -6 0 53 9689 0 55 8178 0 56 7000 0 57 3829 0 58 3072 0 60 10208 0 61 6610 0 62 3274 0 63 4984 0 64 4424 0 65 3319 0 66 7554 0 68 7934 0 70 10306 0 71 7476 0 72 1137 0 73 -10 0 74 4934 0 75 6604 0 76 3170 0 77 1594 0 78 6667 0 79 8647 0 80 3690 0 81 8308 0 82 1254 0 83 1648 0 84 1519 0 85 10500 0 88 4543 0 89 3621 0 90 3587 0 91 2285 0 92 7261 0 93 6849 0 94 4386 0 95 4605 0 96 2845 0 99 8538 0 100 3014 0 101 9927 0 103 5787 0 104 1222 0 105 8518 0 106 8581 0 107 4531 0 108 7962 0 109 -7 0 110 1804 0 111 4837 0 113 9309 0 114 5335 0 115 10078 0 116 5023 0 117 5290 0 118 5117 0 119 8428 0 121 4807 0 122 9356 0 1
JOJ Answer
-106 -86 -102 -105 1028 864 -84 865 853 982 -12 1431 996 908 1135 -13 -42 1066 897 939 945 -14 -136 877 1060 915 -29 1930 862 2060 -49 918 920 -9 1012 933 -117 899 -56 -119 864 -120 864 964 887 889 -94 -116 -136 956 1701 -51 -24 -27 -8 941 968 -25 -24 -118 936 2049 877 -98 -50 -14 -30 871 997 868 1089 -124 894 -60 944 968 928 888 1001 -11 878 856 -106 -55 940 883 -171 924 -38 -75 1644 -70 1739 -55 852 876 -70 1155 -91 1044 968 955 929 955 1183 1427 958 -33 -65 859 891 -153 -15 927 -73 -44 860 861 940 1048 885 903 1722 -65 904 880 -24 911 958 939 909 945 955 903 -80 906 985 -93 1004 858 -41 -25 968 -43 1095 908 901 942 976 -38 -12 -72 1930 -97 -22 880 901 -111 -103 1045 -56 917 1689 990 -162 -41 922 953 1026 -24 1807 -38 1335 948 997 -91 1059 844 909 941 -15 -114 -118 1029 -81 975 867 855 -48 876 906 -94 1052 -129 969 1727 1065 -43 981 885 -90 -118 1008 -36 937 876 987 1360 -14 896 1020 -89 936 -82 884 928 -68 -64 984 -106 942 -42 953 860 1265 -33 -16 -152 -120 891 -8 930 890 838 1947 854 1052 908 2129 -23 996