結果
| 問題 | No.3564 Awkward Timing |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2026-06-09 08:00:30 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 882 bytes |
| 記録 | |
| コンパイル時間 | 252 ms |
| コンパイル使用メモリ | 85,648 KB |
| 実行使用メモリ | 153,964 KB |
| 最終ジャッジ日時 | 2026-06-09 08:01:23 |
| 合計ジャッジ時間 | 40,457 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点1 | 40 % | AC * 36 WA * 2 |
| 満点 | 60 % | AC * 51 WA * 11 |
| 合計 | 0 点 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from math import gcd
N,M,K=list(map(int,input().split()))
E=[[] for i in range(N)]
for i in range(M):
x,y,t=list(map(int,input().split()))
x-=1
y-=1
E[x].append((y,t))
E[y].append((x,t))
DIS=[1<<63]*N
DIS[0]=0
Q=[(0,0)]
while Q:
time,ind=heappop(Q)
if DIS[ind]!=time:
continue
for to,cost in E[ind]:
if DIS[to]>DIS[ind]+cost:
DIS[to]=DIS[ind]+cost
heappush(Q,(DIS[to],to))
DIS2=[1<<63]*N
DIS2[N-1]=0
Q=[(0,N-1)]
while Q:
time,ind=heappop(Q)
if DIS2[ind]!=time:
continue
for to,cost in E[ind]:
if DIS2[to]>DIS2[ind]+cost:
DIS2[to]=DIS2[ind]+cost
heappush(Q,(DIS2[to],to))
g=K
for i in range(N):
for _,t in E[i]:
g=gcd(g,2*t)
x=DIS[N-1]
#print(x,g)
print(x%g)
titia