結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:43:01 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,279 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,144 KB |
実行使用メモリ | 85,612 KB |
最終ジャッジ日時 | 2025-06-12 20:43:16 |
合計ジャッジ時間 | 6,729 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 17 |
ソースコード
import sys def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 A = list(map(int, input[idx:idx+N])) idx += N B = list(map(int, input[idx:idx+N])) idx += N min_max = float('inf') for s in range(N): # Generate the order of B starting at s order = [] for i in range(N): order.append(B[(s + i) % N]) current_level = A.copy() count = [0] * N for b in order: # Find the monster with minimal current level, and smallest index if tie min_level = float('inf') selected = -1 for i in range(N): if current_level[i] < min_level: min_level = current_level[i] selected = i elif current_level[i] == min_level: if i < selected: selected = i # Update the selected monster exp = b // 2 current_level[selected] += exp count[selected] += 1 # Compute the maximum count current_max = max(count) if current_max < min_max: min_max = current_max print(min_max) if __name__ == '__main__': main()