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, you will still get Wrong Answer because the complete output may be longer and there might be errors in the future lines.

Please double check your code to solve this problem and try again.

Your Answer

Invalid graph. Exiting.
9115
-1
4074
8646
INF
10482
4056
3540
INF
7746
INF
6719
10496
3522
3138
3884
1102
3361
2569
6980
3465
INF
INF
INF
2609
2722
6780
9844
6587
INF
7547
2421
9158
2161
7901
7972
9265
2539
7343
3002
6904
8311
6963
7029
4581
8212
3746
3717
INF
6811
5535
6859
-3
INF
1276
-4
4371
5346
1479
8761
2989
INF
1653
3217
10535
1107
4327
1131
6001
INF
-5
10337
1315
INF
9535
8451
9372
-3
7188
3697
INF
5509
6895
6100
2622
2614
3041
5828
2148
3943
6506
7923
7385
4387
5689
7673
-6
INF
6746
7032
3243
9209
7372
7116
7771
4167
8218
8703
6284
3609
5634
8069
7761
5493
3965
9053
4920
6936
INF
3082
INF
9086
1389
5819
INF
4118
7909
4055
7783
1142
5449
INF
7863
6341
10324
INF
INF
7971
8464
2333
7653
8745
INF
7586
INF
1185
9890
2793
6019
INF
8732
9895
-7
INF
1339
3638
7039
3821
2443
9534
4143
INF
1095
1273
INF
INF
2511
8872
3002
2319
7213
INF
4107
1565
10466
5966
5814
5900
1339
4685
4833
1708
INF
9307
8288
5959
9705
2032
INF
6294
INF
10409
INF
10089
2482
-5
2741
INF
1292
2039
-2
3294
2198
3791
4431
6457
INF
4348
1056

JOJ Answer

-12
-149
874
-184
830
910
810
921
-80
824
845
837
1334
-176
922
999
1004
1720
916
1515
927
995
855
1183
-61
-93
790
-104
848
911
783
1208
891
991
-17
846
-143
781
-65
-164
840
-174
-116
802
1054
790
-45
826
824
828
1079
872
-22
949
-40
-76
872
794
982
842
772
-14
792
-27
-91
-16
-171
-82
872
938
-42
1114
-10
1906
837
788
-151
-26
917
-58
859
892
905
796
-34
871
-185
771
848
-171
816
993
997
-35
-129
-226
-162
1216
994
-142
884
871
804
963
841
820
-114
904
-27
-97
843
889
-34
1065
784
819
-35
989
1156
922
-136
928
922
831
789
925
-165
-151
-180
859
-13
887
858
907
936
933
916
834
868
-122
-13
-75
-98
899
-69
813
-11
818
781
804
843
-45
-7
791
-42
-15
786
817
-26
1086
-170
817
1095
-164
888
791
883
784
-164
811
-106
987
876
1001
892
-25
-20
930
-21
956
917
808
933
-28
-20
-60
792
902
-20
-41
860
-82
926
1054
865
-34
-152
-9
-33
865
-35
835
872
851
821
959
-200
-99
908
-163
1089
959
815
854
1005
-49
880
-100
835
-38
-93
-109
1149
802
796
941
-143
779
928
828
816
-151
-68
917
778
-174
894
-94
895
780
780
-59
885