結果

問題 No.3597 Queen Score Attack 2
コンテスト
ユーザー moon17
提出日時 2026-07-24 22:35:05
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 303 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 95,860 KB
実行使用メモリ 223,216 KB
最終ジャッジ日時 2026-07-24 22:35:23
合計ジャッジ時間 8,402 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(h,w,sx,sy,n),*e=[[*map(int,s.split())]for s in open(0)]
sx-=1;sy-=1
INF=1<<60
s=[0]+[-INF]*n
e=[(sx,sy,0)]+[(x-1,y-1,c)for x,y,c in e]
for i in range(1,n+1):
  x,y,c=e[i]
  bx,by,_=e[i-1]
  if i>1:
    s[i]=s[i-2]+c
  if bx==x or by==y or abs(bx-x)==abs(by-y):
    s[i]=max(s[i],s[i-1]+c)
print(max(s))
0