結果

問題 No.9 モンスターのレベル上げ
ユーザー takakintakakin
提出日時 2020-04-30 23:07:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,790 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 8,804 KB
最終ジャッジ日時 2023-08-22 20:11:29
合計ジャッジ時間 38,065 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,432 KB
testcase_01 AC 19 ms
8,468 KB
testcase_02 AC 3,790 ms
8,780 KB
testcase_03 AC 2,966 ms
8,640 KB
testcase_04 AC 1,645 ms
8,796 KB
testcase_05 AC 1,085 ms
8,696 KB
testcase_06 AC 400 ms
8,724 KB
testcase_07 AC 26 ms
8,476 KB
testcase_08 AC 511 ms
8,668 KB
testcase_09 AC 3,620 ms
8,668 KB
testcase_10 AC 18 ms
8,388 KB
testcase_11 AC 3,614 ms
8,804 KB
testcase_12 AC 3,598 ms
8,608 KB
testcase_13 AC 3,350 ms
8,620 KB
testcase_14 AC 3,649 ms
8,664 KB
testcase_15 AC 3,363 ms
8,692 KB
testcase_16 AC 81 ms
8,480 KB
testcase_17 AC 2,198 ms
8,700 KB
testcase_18 AC 1,852 ms
8,788 KB
testcase_19 AC 56 ms
8,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i)*(10**4) for i in input().split()]
B=[int(i)//2 for i in input().split()]
import heapq
import copy
ans=n
for i in range(n):
  Q=copy.deepcopy(A)
  heapq.heapify(Q)
  for j in range(n):
    ind=i+j
    if ind>=n:
      ind%=n
    q=heapq.heappop(Q)
    q+=B[ind]*(10**4)+1
    heapq.heappush(Q,q)
  cur=0
  for q in Q:
    cur=max(cur,q%(10**4))
  ans=min(ans,cur)
print(ans)
0