結果
問題 |
No.318 学学学学学
|
ユーザー |
|
提出日時 | 2024-07-28 04:22:52 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 929 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 123,808 KB |
最終ジャッジ日時 | 2024-07-28 04:22:57 |
合計ジャッジ時間 | 5,074 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 RE * 16 |
ソースコード
## 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.popleft() print(" ".join(map(str, answer))) if __name__ == '__main__': main()