結果
| 問題 | No.3086 Re One Two | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-04-04 22:53:33 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 462 bytes | 
| コンパイル時間 | 513 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 85,136 KB | 
| 最終ジャッジ日時 | 2025-04-04 22:53:49 | 
| 合計ジャッジ時間 | 12,624 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 8 WA * 24 | 
ソースコード
N=int(input())
stack1=[]
stack2=[]
for i in range(1,N+1):
    A,B=map(int,input().split())
    if A==0:
        if B==0:
            print(i)
            while len(stack1) and len(stack2) and stack1[-1]>stack2[-1]:
                print(stack1.pop())
        elif B==1:
            print(i)
            print(stack2.pop())
        else:
            stack2.append(i)
    else:stack1.append(i)
stack=sorted(stack1+stack2,reverse=True)
for i in stack:
    print(i)
            
            
            
        