結果
| 問題 | No.3086 Re One Two |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-04-05 13:35:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 352 ms / 2,000 ms |
| コード長 | 450 bytes |
| 記録 | |
| コンパイル時間 | 800 ms |
| コンパイル使用メモリ | 82,560 KB |
| 実行使用メモリ | 145,664 KB |
| 最終ジャッジ日時 | 2025-04-05 13:35:39 |
| 合計ジャッジ時間 | 13,832 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
nex = dict()
pre = -1
for i, (A, B) in enumerate(AB):
if A == 1:
nex[i+1] = i
if B == 2:
pre = i
elif B == 1:
nex[i] = pre
ans = []
for i, (A, B) in enumerate(AB):
if A != 1 and B != 2:
ans.append(i)
now = i
while now in nex:
now = nex[now]
ans.append(now)
for a in ans:
print(a+1)
detteiuu