結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー KudeKude
提出日時 2023-05-19 22:09:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 367 ms / 2,000 ms
コード長 980 bytes
コンパイル時間 712 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 155,232 KB
最終ジャッジ日時 2023-08-23 03:23:05
合計ジャッジ時間 34,865 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,404 KB
testcase_01 AC 77 ms
71,196 KB
testcase_02 AC 275 ms
107,568 KB
testcase_03 AC 235 ms
108,256 KB
testcase_04 AC 215 ms
108,252 KB
testcase_05 AC 210 ms
107,900 KB
testcase_06 AC 220 ms
107,984 KB
testcase_07 AC 200 ms
108,108 KB
testcase_08 AC 237 ms
118,284 KB
testcase_09 AC 233 ms
120,864 KB
testcase_10 AC 248 ms
121,232 KB
testcase_11 AC 241 ms
111,144 KB
testcase_12 AC 231 ms
117,936 KB
testcase_13 AC 296 ms
121,836 KB
testcase_14 AC 251 ms
120,764 KB
testcase_15 AC 226 ms
111,488 KB
testcase_16 AC 272 ms
109,284 KB
testcase_17 AC 260 ms
118,464 KB
testcase_18 AC 281 ms
141,828 KB
testcase_19 AC 267 ms
126,180 KB
testcase_20 AC 282 ms
128,612 KB
testcase_21 AC 278 ms
127,168 KB
testcase_22 AC 272 ms
141,404 KB
testcase_23 AC 282 ms
131,952 KB
testcase_24 AC 267 ms
133,176 KB
testcase_25 AC 273 ms
136,028 KB
testcase_26 AC 277 ms
130,936 KB
testcase_27 AC 280 ms
141,224 KB
testcase_28 AC 285 ms
128,208 KB
testcase_29 AC 308 ms
130,348 KB
testcase_30 AC 288 ms
131,100 KB
testcase_31 AC 281 ms
130,648 KB
testcase_32 AC 304 ms
128,548 KB
testcase_33 AC 284 ms
140,444 KB
testcase_34 AC 282 ms
137,796 KB
testcase_35 AC 270 ms
128,692 KB
testcase_36 AC 285 ms
124,512 KB
testcase_37 AC 298 ms
138,240 KB
testcase_38 AC 271 ms
123,772 KB
testcase_39 AC 367 ms
124,388 KB
testcase_40 AC 254 ms
107,860 KB
testcase_41 AC 245 ms
107,772 KB
testcase_42 AC 261 ms
125,296 KB
testcase_43 AC 263 ms
124,992 KB
testcase_44 AC 269 ms
155,232 KB
testcase_45 AC 268 ms
131,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
ins = list(map(int, sys.stdin.buffer.read().split()))
ins.reverse()
for _ in range(ins.pop()):
    n, m = ins.pop(), ins.pop()
    d = {ins.pop() : 1 for _ in range(n)}
    for _ in range(m):
        x = ins.pop()
        d[x] = d.get(x, 0) | 2
    v = [[], [], []]
    for x, t in d.items():
        v[t - 1].append(x)
    ans = []
    if not v[2]:
        if v[0] and v[1]:
            print('No')
            continue
        elif v[0]:
            ans = [(0, x) for x in v[0]]
        else:
            ans = [(1, x) for x in v[1]]
    else:
        for x in v[2]:
            if not ans:
                ans.extend((0, x) for x in v[0])
                ans.append((0, x))
                ans.append((1, x))
                ans.extend((1, x) for x in v[1])
            else:
                t = ans[-1][0]
                ans.append((t, x))
                ans.append((t ^ 1, x))
    print('Yes')
    for t, x in ans:
        print(('Red' if t == 0 else 'Blue'), x)
0