結果

問題 No.9 モンスターのレベル上げ
ユーザー takakintakakin
提出日時 2020-04-30 23:07:26
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 4,034 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 65 ms
使用メモリ 8,168 KB
最終ジャッジ日時 2023-01-09 19:01:12
合計ジャッジ時間 40,440 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 19 ms
7,900 KB
testcase_01 AC 19 ms
7,952 KB
testcase_02 AC 4,034 ms
8,076 KB
testcase_03 AC 3,205 ms
8,164 KB
testcase_04 AC 1,719 ms
7,976 KB
testcase_05 AC 1,185 ms
7,972 KB
testcase_06 AC 434 ms
8,088 KB
testcase_07 AC 27 ms
7,960 KB
testcase_08 AC 559 ms
7,932 KB
testcase_09 AC 3,937 ms
8,068 KB
testcase_10 AC 19 ms
8,004 KB
testcase_11 AC 3,845 ms
8,140 KB
testcase_12 AC 3,934 ms
7,976 KB
testcase_13 AC 3,686 ms
7,992 KB
testcase_14 AC 3,985 ms
8,168 KB
testcase_15 AC 3,576 ms
8,076 KB
testcase_16 AC 88 ms
8,048 KB
testcase_17 AC 2,331 ms
8,132 KB
testcase_18 AC 1,965 ms
7,988 KB
testcase_19 AC 60 ms
7,936 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