結果
問題 | No.1780 [Cherry Anniversary] 真冬に咲く26の櫻の木 |
ユーザー | 👑 Kazun |
提出日時 | 2021-11-25 22:37:17 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 941 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 86,972 KB |
実行使用メモリ | 78,420 KB |
最終ジャッジ日時 | 2023-09-23 08:33:10 |
合計ジャッジ時間 | 8,876 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
75,816 KB |
testcase_01 | AC | 73 ms
71,200 KB |
testcase_02 | AC | 119 ms
77,356 KB |
testcase_03 | AC | 97 ms
76,800 KB |
testcase_04 | AC | 128 ms
78,032 KB |
testcase_05 | AC | 129 ms
77,216 KB |
testcase_06 | AC | 135 ms
77,492 KB |
testcase_07 | AC | 131 ms
77,364 KB |
testcase_08 | AC | 131 ms
77,716 KB |
testcase_09 | AC | 139 ms
78,420 KB |
testcase_10 | AC | 113 ms
77,460 KB |
testcase_11 | AC | 124 ms
77,516 KB |
testcase_12 | AC | 113 ms
77,212 KB |
testcase_13 | AC | 85 ms
76,408 KB |
testcase_14 | TLE | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
#Greedy 解法 (TLE) def member_id(alpha): return ord(alpha)-65 # ord("A")=65 C=list(map(int,input().split())) K=list(map(int,input().split())) inf=float("inf"); number=16; member=26 M=[[] for _ in range(member)] N=int(input()) for _ in range(N): S,A,B,E=input().split() A=int(A)-1; B=int(B)-1; E=int(E) for s in S: t=member_id(s) M[t].append((A,B,E)) Data=[[-inf]*number for _ in range(member)] for alpha in range(member): DP=[-inf]*number; DP[C[alpha]-1]=0 Data[alpha][C[alpha]-1]=0 for _ in range(K[alpha]): E=DP DP=[-inf]*number for a,b,e in M[alpha]: DP[a]=max(DP[a],E[b]+e) DP[b]=max(DP[b],E[a]+e) for c in range(number): Data[alpha][c]=max(Data[alpha][c],DP[c]) F=[0]*number for alpha in range(member): for c in range(number): F[c]+=Data[alpha][c] Ans=max(F) print(Ans if Ans>-inf else "Impossible")