結果
問題 | No.610 区間賞(Section Award) |
ユーザー |
![]() |
提出日時 | 2025-03-20 20:46:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 215 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 238 ms |
コンパイル使用メモリ | 82,156 KB |
実行使用メモリ | 106,704 KB |
最終ジャッジ日時 | 2025-03-20 20:46:38 |
合計ジャッジ時間 | 7,552 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
n = int(input())a = list(map(int, input().split()))b = list(map(int, input().split()))posA = [0] * (n + 1)for i in range(n):x = a[i]posA[x] = i + 1 # 1-basedposB = [0] * (n + 1)for i in range(n):x = b[i]posB[x] = i + 1 # 1-basedsorted_teams = sorted(range(1, n + 1), key=lambda x: posA[x])# Compute min_suffixmin_suffix = [0] * nmin_suffix[-1] = posB[sorted_teams[-1]]for i in range(n - 2, -1, -1):min_suffix[i] = min(posB[sorted_teams[i]], min_suffix[i + 1])result = []for x in range(1, n + 1):i = posA[x] - 1 # Convert to 0-based index in sorted_teamsif i + 1 >= n:result.append(x)else:if posB[x] < min_suffix[i + 1]:result.append(x)for num in sorted(result):print(num)