Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr


        

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

1033
2348
1290
1062
1792
1073
958
1093
2102
-21
-21
1177
-59
986
1031
-54
1060
1614
949
-15
-27
1038
1059
1144
1392
-27
1035
-56
1454
-19
1068
-55
983
1050
1116
1200
1224
1743
1069
1152
1055
1500
975
1498
1337
-17
1114
1302
1004
1029
2108
1345
2158
1717
1387
1007
988
1225
1341
-43
2319
-21
2252
-16
1047
1315
-36
1402
2285
1708
-25
-17
1315
988
2192
1617
-14
1085
998
-22
1006
2357
1138
1152
1024
-59
1392
2053
-22
1311
2569
1077
2323
-9
1288
-19
1256
2461
1414
1354
1048
1702
1131
1028
-6
-18
1532
1308
1095
1029
1414
1573
1307
1493
-30
1024
-23
1161
-10
1402
1002
2124
-30
1067
-29
1311
-26
1008
1318
-24
1429
-2
2298
1063
-37
-35
1557
2206
-30
-33
973
979
1696
1863
1721
988
-16
1244
2123
1030
-27
-2
2134
-19
1106
1146
1065
979
1233
1073
1035
-7
1162
1043
2149
-34
1024
-57
-25
1026
1091
-31
1291
1106
1466
1026
1766
1065
1709
1024
1163
1028
1074
1090
1156
1617
2324
1066
995
1078
1140
1052
954
988
1523
1022
-21
1547
992
1231
2134
1074
1243
1737
-11
1061
992
954
1109
1299
1072
1017
-50
-26
1731
941
2612
1074
1021
960

JOJ Answer

1033
1128
973
936
987
1073
958
1079
1074
-21
-41
886
-72
937
914
-67
912
1073
938
-15
-27
913
989
929
941
-33
952
-84
1454
-19
1068
-84
983
910
983
1134
906
902
930
1132
947
1500
934
1070
899
-17
1114
1266
935
943
1727
1345
2113
1040
1308
992
988
950
1120
-70
1725
-21
2067
-33
1008
1286
-36
1402
2161
974
-51
-23
929
935
2047
1617
-26
933
959
-22
961
2345
967
938
971
-79
1392
2013
-29
1136
2240
1077
1091
-9
1241
-19
1256
2207
1348
1354
1035
925
947
958
-6
-18
1532
1308
1095
1029
1380
907
1289
1063
-32
-47
-23
1161
-14
1402
898
2101
-30
933
-60
968
-32
891
914
-42
939
-2
2226
1001
-37
-35
1438
1199
-45
-48
959
979
962
1863
1721
943
-33
1236
1217
1030
-27
-2
1135
-19
1106
1146
933
903
996
1073
949
-7
1162
1002
1721
-34
994
-87
-25
986
1016
-49
1291
1033
1425
1026
1766
1065
973
905
1002
912
1054
1054
1156
982
967
1057
967
1062
920
1052
905
914
1523
912
-21
1114
918
969
2079
927
904
1461
-23
932
901
924
926
1299
977
1002
-72
-26
1731
901
2588
991
1018
921
1145
1049
1094
1541
-32
-3
908
2016
2088
940
933
-33
1482
-