# hw04-2

user_8757790586

python

2 years ago

511 B

3

Indexable

Never

^{}

n = int(input()) expected_fire = input().split(',') for i in range(n): expected_fire[i] = int(expected_fire[i]) dist = [] for i in range(n): tmp = input().split(',') for j in range(n): tmp[j] = int(tmp[j]) dist.append(tmp) min_dist = -1 for i in range(n): acc_dist = 0 for j in range(n): acc_dist += (expected_fire[j] * dist[i][j]) if min_dist == -1 or acc_dist < min_dist: min_dist = acc_dist candidate = i + 1 print(candidate, min_dist, sep=',')