結果
問題 |
No.3086 Re One Two
|
ユーザー |
![]() |
提出日時 | 2025-04-04 22:29:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 552 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 379 ms |
コンパイル使用メモリ | 82,612 KB |
実行使用メモリ | 112,220 KB |
最終ジャッジ日時 | 2025-04-04 22:29:39 |
合計ジャッジ時間 | 15,953 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
N = int(input()) G = [[] for _ in range(N + 2)] A, B = [0], [0] stack = [] for i in range(1, N + 1): a, b = map(int, input().split()) A.append(a) B.append(b) if a == 1: G[i + 1].append(i) if b == 1: j = stack.pop() G[i].append(j) elif b == 1: print(i) j = stack.pop() print(j) while len(G[j]): j = G[j].pop() print(j) elif b == 2: stack.append(i) else: print(i) j = i while len(G[j]): j = G[j].pop() print(j)