結果
問題 | No.1 道のショートカット |
ユーザー |
|
提出日時 | 2019-05-19 01:35:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 131 ms / 5,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-07-20 16:39:41 |
合計ジャッジ時間 | 3,501 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 40 |
ソースコード
n=int(input()) c=int(input()) v=int(input()) S=list(map(int,input().split())) T=list(map(int,input().split())) Y=list(map(int,input().split())) M=list(map(int,input().split())) z=zip(S,T,Y,M) d=[[None]*(c+1) for i in range(n)] d[0][0] = 0 for s,t,y,m in sorted(z,key=lambda x:(x[0],x[1])): for j in range(c+1): a=d[s-1][j] if a is not None: q=y+j if c<q: break p=t-1 x=a+m if d[p][q] is None or x<d[p][q]: d[p][q]=x o=None for x in d[n-1]: if x is not None: if o is None or x<o: o=x print(-1 if o is None else o)