結果
問題 |
No.9 モンスターのレベル上げ
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:41:59 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,849 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,088 KB |
実行使用メモリ | 89,548 KB |
最終ジャッジ日時 | 2025-06-12 20:42:14 |
合計ジャッジ時間 | 6,772 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 TLE * 1 -- * 17 |
ソースコード
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): current_A = A.copy() selected = [False] * N counts = [0] * N for step in range(N): enemy = B[(s + step) % N] min_val = float('inf') min_indices = [] for i in range(N): if current_A[i] < min_val: min_val = current_A[i] min_indices = [i] elif current_A[i] == min_val: min_indices.append(i) found = False for i in min_indices: if not selected[i]: selected[i] = True counts[i] +=1 current_A[i] += (enemy // 2) found = True break if not found: for i in min_indices: if not selected[i]: selected[i] = True counts[i] +=1 current_A[i] += (enemy // 2) found = True break if not found: for i in min_indices: selected[i] = True counts[i] +=1 current_A[i] += (enemy // 2) found = True break max_count = max(counts) if max_count < min_max: min_max = max_count if min_max == 1: break print(min_max) return if __name__ == "__main__": main()