Submission #1211878

#TimeUsernameProblemLanguageResultExecution timeMemory
1211878ackerman2840악어의 지하 도시 (IOI11_crocodile)C11
Compilation error
0 ms0 KiB
from heapq import heappop,heappush

n,m,k=map(int,input().split())

adj=[[] for _ in range(n)]

for _ in range(m):

    u,v,d=map(int,input().split())

    adj[u].append((v,d))
    adj[v].append((u,d))

exit=list(map(int,input().split()))

dist=[]

for _ in range(n):
    dist.append([float('inf'),float('inf')])

pq=[]

for i in exit:

    dist[i]=[0,0]
    heappush(pq,(0,i))

while pq:

    d,node=heappop(pq)
    d*=-1

    if dist[node][1]!=d:continue

    for to,dd in adj[node]:

        if dist[to][0]>d+dd:

            if dist[to][0]<dist[to][1]:heappush(pq,(-dist[to][0],to))

            dist[to][1]=dist[to][0]
            dist[to][0]=d+dd

        elif dist[to][1]>d+dd:

            heappush(pq,(-d-dd,to))
            dist[to][1]=d+dd

print(dist[0][1])

Compilation message (stderr)

crocodile.c:1:1: error: unknown type name 'from'
    1 | from heapq import heappop,heappush
      | ^~~~
crocodile.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    1 | from heapq import heappop,heappush
      |            ^~~~~~
crocodile.c:1:12: error: unknown type name 'import'
crocodile.c:19:24: warning: multi-character character constant [-Wmultichar]
   19 |     dist.append([float('inf'),float('inf')])
      |                        ^~~~~
crocodile.c:19:37: warning: multi-character character constant [-Wmultichar]
   19 |     dist.append([float('inf'),float('inf')])
      |                                     ^~~~~