結果
| 問題 |
No.572 妖精の演奏
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2020-05-24 08:30:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 745 ms / 2,000 ms |
| コード長 | 817 bytes |
| コンパイル時間 | 110 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 44,756 KB |
| 最終ジャッジ日時 | 2024-10-10 20:29:44 |
| 合計ジャッジ時間 | 14,510 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import numpy as np
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
def inmax(aa,bb):
h=len(aa)
w=len(bb[0])
res=np.zeros((h,w),dtype="i8")
for i in range(h):
for j in range(w):
res[i][j]=np.max(aa[i]+bb[:,j])
return res
def main():
n=II()-1
m=II()
base=np.array(LLI(m),dtype="i8")
aa=np.zeros((m,m),dtype="i8")
while n:
if n&1:aa=inmax(aa,base)
base=inmax(base,base)
n>>=1
print(np.max(aa))
main()
mkawa2