結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | とろちゃ |
提出日時 | 2023-05-19 22:46:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 367 ms / 2,000 ms |
コード長 | 1,846 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 146,672 KB |
最終ジャッジ日時 | 2024-12-21 03:25:05 |
合計ジャッジ時間 | 33,361 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
52,352 KB |
testcase_01 | AC | 47 ms
52,224 KB |
testcase_02 | AC | 343 ms
78,928 KB |
testcase_03 | AC | 210 ms
80,384 KB |
testcase_04 | AC | 211 ms
79,616 KB |
testcase_05 | AC | 214 ms
80,576 KB |
testcase_06 | AC | 240 ms
81,032 KB |
testcase_07 | AC | 193 ms
80,512 KB |
testcase_08 | AC | 237 ms
97,012 KB |
testcase_09 | AC | 234 ms
97,792 KB |
testcase_10 | AC | 207 ms
105,956 KB |
testcase_11 | AC | 270 ms
101,708 KB |
testcase_12 | AC | 225 ms
108,752 KB |
testcase_13 | AC | 324 ms
104,752 KB |
testcase_14 | AC | 274 ms
102,784 KB |
testcase_15 | AC | 214 ms
101,888 KB |
testcase_16 | AC | 263 ms
94,080 KB |
testcase_17 | AC | 283 ms
97,232 KB |
testcase_18 | AC | 237 ms
114,944 KB |
testcase_19 | AC | 279 ms
115,468 KB |
testcase_20 | AC | 263 ms
133,248 KB |
testcase_21 | AC | 273 ms
134,100 KB |
testcase_22 | AC | 240 ms
119,296 KB |
testcase_23 | AC | 276 ms
133,588 KB |
testcase_24 | AC | 267 ms
119,128 KB |
testcase_25 | AC | 258 ms
118,876 KB |
testcase_26 | AC | 249 ms
131,252 KB |
testcase_27 | AC | 260 ms
119,588 KB |
testcase_28 | AC | 267 ms
126,316 KB |
testcase_29 | AC | 251 ms
122,572 KB |
testcase_30 | AC | 269 ms
114,944 KB |
testcase_31 | AC | 252 ms
133,592 KB |
testcase_32 | AC | 255 ms
133,352 KB |
testcase_33 | AC | 236 ms
108,940 KB |
testcase_34 | AC | 258 ms
109,532 KB |
testcase_35 | AC | 273 ms
112,796 KB |
testcase_36 | AC | 267 ms
126,132 KB |
testcase_37 | AC | 272 ms
114,944 KB |
testcase_38 | AC | 242 ms
77,808 KB |
testcase_39 | AC | 367 ms
79,084 KB |
testcase_40 | AC | 149 ms
76,248 KB |
testcase_41 | AC | 255 ms
79,188 KB |
testcase_42 | AC | 261 ms
113,428 KB |
testcase_43 | AC | 256 ms
113,372 KB |
testcase_44 | AC | 211 ms
146,672 KB |
testcase_45 | AC | 204 ms
146,540 KB |
ソースコード
# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1") # from bisect import * # from collections import * # from heapq import * # from itertools import * # from math import * # from datetime import * # from decimal import* # from string import ascii_lowercase,ascii_uppercase # import numpy as np import sys import os # sys.setrecursionlimit(10**6) INF = 10**18 MOD = 998244353 # MOD = 10**9 + 7 File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdin def input(): return File.readline()[:-1] # /////////////////////////////////////////////////////////////////////////// T = int(input()) def f(l, s): res = 0 flag = [0] * (len(l)) for i in range(len(l)): if l[i] in s: flag[i] = 1 res += 1 return flag, res for _ in range(T): N, M = map(int, input().split()) A = list(map(int, input().split())) As = set(A) B = list(map(int, input().split())) Bs = set(B) if len(A) == 0 or len(B) == 0: print("Yes") print(*["Red " + str(i) for i in A], sep="\n") if len(A) else print( *["Blue " + str(i) for i in B], sep="\n" ) continue flagA, cnt1 = f(A, Bs) flagB, cnt2 = f(B, As) if cnt1 == 0 or cnt2 == 0: print("No") continue print("Yes") for i in range(N): if not flagA[i]: print("Red", A[i]) parity = 1 flag = 0 for i in range(N): if flagA[i]: if parity: print("Red", A[i]) print("Blue", A[i]) else: print("Blue", A[i]) print("Red", A[i]) parity ^= 1 if flag == 0: for j in range(M): if not flagB[j]: print("Blue", B[j]) flag = 1