結果
問題 |
No.318 学学学学学
|
ユーザー |
|
提出日時 | 2024-07-28 04:20:56 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 925 bytes |
コンパイル時間 | 592 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 124,056 KB |
最終ジャッジ日時 | 2024-07-28 04:21:02 |
合計ジャッジ時間 | 5,551 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 RE * 17 |
ソースコード
## https://yukicoder.me/problems/no/318 from collections import deque def main(): N = int(input()) A = list(map(int, input().split())) a_map = {} for i in range(N): a = A[i] if a not in a_map: a_map[a] = [i, i] else: a_map[a][1] = i event_map = {} for a, (s, g) in a_map.items(): if s not in event_map: event_map[s] = [] event_map[s].append((a, g)) queue = deque() answer = [0] * N for t in range(N): if t in event_map: for a, g in event_map[t]: while len(queue) > 0 and queue[-1][0] < a: queue.pop() queue.append((a, g)) answer[t] = queue[0][0] while len(queue) > 0 and queue[0][1] <= t: queue.pop() print(" ".join(map(str, answer))) if __name__ == '__main__': main()