BOJ - 11265 - 끝나지 않는 파티

Updated:

import sys

def solution():
    N, M = map(int, sys.stdin.readline().split())
    Floyd = []
    for _ in range(N):
        Floyd.append(list(map(int, sys.stdin.readline().split())))

    for k in range(N):
        for i in range(N):
            for j in range(N):
                if i == j: continue
                Floyd[i][j] = min(Floyd[i][j], Floyd[i][k] + Floyd[k][j])

    for i in range(M):
        A, B, C = map(int, sys.stdin.readline().split())
        A, B = A-1, B-1

        if Floyd[A][B] <= C: print('Enjoy other party')
        else: print('Stay here')

solution()

https://www.acmicpc.net/problem/11265

Categories:

Updated:

Leave a comment