結果
問題 | No.572 妖精の演奏 |
ユーザー |
![]() |
提出日時 | 2020-03-07 07:50:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 487 ms / 2,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 44,480 KB |
最終ジャッジ日時 | 2024-10-14 11:37:49 |
合計ジャッジ時間 | 11,517 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
#!/usr/bin/env python3# %%import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesimport numpy as np# %%N = int(readline())M = int(readline())A = np.array(read().split(), np.int64).reshape(M, M)# %%def merge(A, B):return (A[:, :, None] + B[None, :, :]).max(axis=1)# %%def power(A, n):if n == 1:return AB = power(A, n // 2)B = merge(B, B)if n % 2 == 0:return Breturn merge(A, B)# %%print(power(A, N - 1).max())