結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー | とろちゃ |
提出日時 | 2023-05-19 22:46:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 355 ms / 2,000 ms |
コード長 | 1,846 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 146,868 KB |
最終ジャッジ日時 | 2024-06-01 01:32:19 |
合計ジャッジ時間 | 32,433 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
52,096 KB |
testcase_01 | AC | 42 ms
52,352 KB |
testcase_02 | AC | 314 ms
79,188 KB |
testcase_03 | AC | 205 ms
80,384 KB |
testcase_04 | AC | 207 ms
79,616 KB |
testcase_05 | AC | 211 ms
80,324 KB |
testcase_06 | AC | 212 ms
80,768 KB |
testcase_07 | AC | 190 ms
80,256 KB |
testcase_08 | AC | 237 ms
97,020 KB |
testcase_09 | AC | 224 ms
97,536 KB |
testcase_10 | AC | 192 ms
106,084 KB |
testcase_11 | AC | 238 ms
101,932 KB |
testcase_12 | AC | 216 ms
109,156 KB |
testcase_13 | AC | 259 ms
105,008 KB |
testcase_14 | AC | 229 ms
102,656 KB |
testcase_15 | AC | 204 ms
101,912 KB |
testcase_16 | AC | 239 ms
94,052 KB |
testcase_17 | AC | 239 ms
98,016 KB |
testcase_18 | AC | 240 ms
115,328 KB |
testcase_19 | AC | 271 ms
116,028 KB |
testcase_20 | AC | 260 ms
133,888 KB |
testcase_21 | AC | 273 ms
133,588 KB |
testcase_22 | AC | 242 ms
119,808 KB |
testcase_23 | AC | 269 ms
133,684 KB |
testcase_24 | AC | 260 ms
119,040 KB |
testcase_25 | AC | 259 ms
119,168 KB |
testcase_26 | AC | 247 ms
131,456 KB |
testcase_27 | AC | 280 ms
119,424 KB |
testcase_28 | AC | 297 ms
126,992 KB |
testcase_29 | AC | 274 ms
123,092 KB |
testcase_30 | AC | 275 ms
115,072 KB |
testcase_31 | AC | 264 ms
133,716 KB |
testcase_32 | AC | 276 ms
133,672 KB |
testcase_33 | AC | 238 ms
108,808 KB |
testcase_34 | AC | 268 ms
109,552 KB |
testcase_35 | AC | 270 ms
112,848 KB |
testcase_36 | AC | 280 ms
126,212 KB |
testcase_37 | AC | 278 ms
115,328 KB |
testcase_38 | AC | 233 ms
77,808 KB |
testcase_39 | AC | 355 ms
79,028 KB |
testcase_40 | AC | 152 ms
77,056 KB |
testcase_41 | AC | 242 ms
78,992 KB |
testcase_42 | AC | 248 ms
113,436 KB |
testcase_43 | AC | 268 ms
113,824 KB |
testcase_44 | AC | 224 ms
146,796 KB |
testcase_45 | AC | 233 ms
146,868 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