Submit Info #40473

Problem Lang User Status Time Memory
Assignment Problem python3 knuu AC 309 ms 47.59 MiB

ケース詳細
Name Status Time Memory
example_00 AC 193 ms 27.69 MiB
hand_minus_00 AC 309 ms 47.02 MiB
hand_plus_00 AC 300 ms 47.00 MiB
max_random_00 AC 244 ms 47.57 MiB
max_random_01 AC 244 ms 47.57 MiB
max_random_02 AC 242 ms 47.56 MiB
max_random_03 AC 248 ms 47.56 MiB
max_random_04 AC 244 ms 47.59 MiB
random_00 AC 194 ms 30.66 MiB
random_01 AC 197 ms 31.15 MiB
random_02 AC 195 ms 28.34 MiB
random_03 AC 194 ms 30.98 MiB
random_04 AC 188 ms 27.64 MiB

import sys import numpy as np from scipy.optimize import linear_sum_assignment def main() -> None: N = int(input()) mat = np.array(sys.stdin.read().split(), dtype=np.int64).reshape((N, N)) row_ind, col_ind = linear_sum_assignment(mat) print(mat[row_ind, col_ind].sum()) print(*col_ind) if __name__ == '__main__': main()