結果
問題 | No.1316 Maximum Minimum Spanning Tree |
ユーザー | hitonanode |
提出日時 | 2020-12-12 05:06:04 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 823 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 56,672 KB |
最終ジャッジ日時 | 2024-09-19 22:13:19 |
合計ジャッジ時間 | 87,191 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 987 ms
56,160 KB |
testcase_01 | AC | 881 ms
56,292 KB |
testcase_02 | AC | 877 ms
56,032 KB |
testcase_03 | AC | 884 ms
56,136 KB |
testcase_04 | AC | 874 ms
56,036 KB |
testcase_05 | AC | 880 ms
56,164 KB |
testcase_06 | AC | 876 ms
56,160 KB |
testcase_07 | AC | 1,056 ms
56,296 KB |
testcase_08 | AC | 1,046 ms
56,036 KB |
testcase_09 | AC | 1,062 ms
56,292 KB |
testcase_10 | AC | 1,067 ms
56,036 KB |
testcase_11 | AC | 954 ms
56,424 KB |
testcase_12 | AC | 961 ms
56,292 KB |
testcase_13 | AC | 975 ms
56,036 KB |
testcase_14 | AC | 954 ms
56,028 KB |
testcase_15 | WA | - |
testcase_16 | AC | 1,067 ms
56,292 KB |
testcase_17 | AC | 1,088 ms
56,416 KB |
testcase_18 | AC | 1,088 ms
56,544 KB |
testcase_19 | AC | 921 ms
56,292 KB |
testcase_20 | AC | 926 ms
56,160 KB |
testcase_21 | AC | 936 ms
56,372 KB |
testcase_22 | AC | 922 ms
56,296 KB |
testcase_23 | AC | 911 ms
56,292 KB |
testcase_24 | AC | 934 ms
56,160 KB |
testcase_25 | AC | 919 ms
56,296 KB |
testcase_26 | AC | 928 ms
56,040 KB |
testcase_27 | AC | 916 ms
56,036 KB |
testcase_28 | AC | 934 ms
56,288 KB |
testcase_29 | AC | 921 ms
56,672 KB |
testcase_30 | AC | 914 ms
56,296 KB |
testcase_31 | AC | 938 ms
56,288 KB |
testcase_32 | AC | 939 ms
56,164 KB |
testcase_33 | AC | 923 ms
56,380 KB |
testcase_34 | AC | 932 ms
56,008 KB |
testcase_35 | AC | 917 ms
56,256 KB |
testcase_36 | AC | 940 ms
56,540 KB |
testcase_37 | AC | 922 ms
56,292 KB |
testcase_38 | AC | 928 ms
56,292 KB |
testcase_39 | AC | 931 ms
56,284 KB |
testcase_40 | AC | 929 ms
56,040 KB |
testcase_41 | AC | 936 ms
56,292 KB |
testcase_42 | AC | 940 ms
56,040 KB |
testcase_43 | WA | - |
testcase_44 | AC | 1,028 ms
56,288 KB |
testcase_45 | AC | 1,027 ms
56,048 KB |
testcase_46 | AC | 1,025 ms
56,292 KB |
testcase_47 | AC | 1,055 ms
56,288 KB |
testcase_48 | AC | 1,046 ms
56,036 KB |
testcase_49 | AC | 1,048 ms
56,292 KB |
testcase_50 | AC | 1,058 ms
56,028 KB |
testcase_51 | WA | - |
testcase_52 | AC | 1,049 ms
56,172 KB |
testcase_53 | AC | 1,055 ms
56,548 KB |
testcase_54 | AC | 1,053 ms
56,164 KB |
testcase_55 | AC | 1,048 ms
56,168 KB |
testcase_56 | AC | 1,066 ms
56,032 KB |
testcase_57 | AC | 1,060 ms
56,292 KB |
testcase_58 | AC | 1,041 ms
56,292 KB |
testcase_59 | AC | 1,042 ms
56,292 KB |
testcase_60 | AC | 1,056 ms
56,420 KB |
testcase_61 | AC | 1,063 ms
56,068 KB |
testcase_62 | AC | 1,047 ms
56,140 KB |
testcase_63 | AC | 1,052 ms
56,292 KB |
testcase_64 | AC | 1,054 ms
56,296 KB |
testcase_65 | AC | 1,080 ms
56,036 KB |
testcase_66 | AC | 1,075 ms
56,288 KB |
testcase_67 | AC | 1,071 ms
56,288 KB |
testcase_68 | AC | 1,070 ms
56,032 KB |
testcase_69 | AC | 1,087 ms
56,288 KB |
testcase_70 | AC | 1,101 ms
56,032 KB |
testcase_71 | AC | 1,096 ms
56,296 KB |
testcase_72 | AC | 1,097 ms
56,420 KB |
testcase_73 | AC | 1,092 ms
56,552 KB |
testcase_74 | AC | 1,108 ms
56,284 KB |
testcase_75 | AC | 932 ms
56,308 KB |
testcase_76 | AC | 933 ms
56,164 KB |
testcase_77 | AC | 919 ms
56,428 KB |
testcase_78 | AC | 1,090 ms
56,292 KB |
testcase_79 | AC | 1,094 ms
56,292 KB |
testcase_80 | AC | 1,097 ms
56,292 KB |
testcase_81 | AC | 1,084 ms
56,288 KB |
ソースコード
# scipy.sparse.csgraph.maximum_flow は現在32bit整数型しか扱えない 想定WA from scipy.sparse import csr_matrix from scipy.sparse.csgraph import maximum_flow N, M, K = map(int, input().split()) A = [-1] * M B = [-1] * M C = [-1] * M D = [-1] * M c2i = [] for i in range(M): A[i], B[i], C[i], D[i] = map(int, input().split()) c2i.append((C[i], i)) c2i.sort() X = [0] * M for ci, i in c2i: mf = [[0] * (N + 2) for _ in range(N + 2)] mf[0][A[i]] += K * N mf[0][B[i]] += K * N for a, b, x in zip(A, B, X): mf[0][a] += x mf[a][b] += x for j in range(N): mf[j + 1][N + 1] += K X[i] = min(D[i], round(maximum_flow(csr_matrix(mf), 0, N + 1).flow_value) - K - sum(X)) if sum(X) < K * (N - 1): print(-1) else: print(sum([c * x for c, x in zip(C, X)]))