結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2020-12-04 09:32:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,330 ms / 5,000 ms |
コード長 | 901 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 82,440 KB |
実行使用メモリ | 81,872 KB |
最終ジャッジ日時 | 2024-09-14 20:00:04 |
合計ジャッジ時間 | 14,291 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
import sys from heapq import heappop,heappush,heapify from copy import deepcopy sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() A,B = LI(),LI() A = [A[i]<<11 for i in range(N)] B = [B[i]//2 for i in range(N)] B = B+B ans = 10**18 for i in range(N): X = deepcopy(A) heapify(X) for j in range(N): n = heappop(X) n0,n1 = divmod(n,1<<11) n0 += B[i+j] n1 += 1 heappush(X,(n0<<11)+n1) ans = min(ans,max(X[i] % (1<<11) for i in range(N))) print(ans)