結果
| 問題 | 
                            No.1328 alligachi-problem
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-12-25 00:36:15 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,073 bytes | 
| コンパイル時間 | 322 ms | 
| コンパイル使用メモリ | 82,108 KB | 
| 実行使用メモリ | 110,080 KB | 
| 最終ジャッジ日時 | 2024-09-21 17:14:47 | 
| 合計ジャッジ時間 | 14,862 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 WA * 1 | 
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
dic = {"RR":[],"RB":[],"BR":[],"BB":[]}
for _ in range(N):
    c,x,y = input().split()
    y = int(y)
    dic[c+x].append((y,_+1))
for color in dic:
    dic[color].sort(reverse=True)
ans = []
R,B = 0,0
while len(ans)<N:
    if dic["BR"] and dic["BR"][-1][0]==R:
        if dic["RB"] and dic["RB"][-1][0]==B:
            exit(print("A","No"))
        elif dic["BB"] and dic["BB"][-1][0]==B:
            ans.append(dic["BB"].pop()[1])
            B += 1
        else:
            ans.append(dic["BR"].pop()[1])
            B += 1
    elif dic["RB"] and dic["RB"][-1][0]==B:
        if dic["RR"] and dic["RR"][-1][0]==R:
            ans.append(dic["RR"].pop()[1])
            R += 1
        else:
            ans.append(dic["RB"].pop()[1])
            R += 1
    elif dic["RR"] and dic["RR"][-1][0]==R:
        ans.append(dic["RR"].pop()[1])
        R += 1
    elif dic["BB"] and dic["BB"][-1][0]==B:
        ans.append(dic["BB"].pop()[1])
        B += 1
    else:
        exit(print("No"))
print("Yes")
print(*ans)