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

1856
1128
2069
1062
2251
1073
958
2143
2028
2032
1056
1145
947
1380
1996
1715
1090
2206
938
2068
1070
1525
1712
1418
1562
1026
1983
967
1454
2029
1068
1024
1369
1357
1000
1200
2000
1379
1082
1877
2000
1500
1678
1498
1059
1005
2342
1266
1427
1110
2104
1856
2117
1717
1758
1610
2160
1267
2391
1062
2095
1126
2067
1195
1008
2785
2041
1827
2762
2011
1020
1090
1923
935
2151
2718
1117
2049
963
1108
961
2345
1110
1102
1020
1703
1392
2013
1118
2338
2569
2186
2323
1925
2524
1013
2283
2445
1348
1354
1035
2120
1792
1630
1107
1004
2154
1308
2130
2063
1380
1343
2451
1493
1093
1148
2202
1161
1035
1827
1110
2101
928
1065
1466
2064
1753
1032
2134
1029
2159
2363
2226
1063
1274
975
1438
2146
1177
1025
971
2151
2182
2532
1721
947
1038
2446
1532
1030
1170
1394
2222
1036
2095
2276
1065
966
2152
1935
1975
1039
1162
2282
1721
924
1541
1009
1556
2119
1243
994
1291
1283
2028
2042
2541
1065
1709
1024
1163
998
1180
1054
1156
2205
1610
2156
967
2069
1508
2119
1406
2143
2178
2162
1009
2148
1480
1782
2079
1094
1512
2114
1342
1062
970
2201
1

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
-