結果

問題 No.2042 RGB Caps
ユーザー tassei903tassei903
提出日時 2022-08-20 10:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 892 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 86,592 KB
最終ジャッジ日時 2024-04-27 20:37:27
合計ジャッジ時間 2,428 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
54,040 KB
testcase_01 AC 35 ms
53,696 KB
testcase_02 AC 38 ms
53,136 KB
testcase_03 AC 34 ms
52,888 KB
testcase_04 AC 33 ms
53,008 KB
testcase_05 AC 34 ms
53,584 KB
testcase_06 AC 51 ms
70,096 KB
testcase_07 AC 85 ms
79,620 KB
testcase_08 AC 107 ms
82,192 KB
testcase_09 AC 59 ms
75,300 KB
testcase_10 AC 114 ms
85,492 KB
testcase_11 AC 60 ms
72,960 KB
testcase_12 AC 102 ms
86,592 KB
testcase_13 AC 103 ms
86,088 KB
testcase_14 AC 104 ms
86,492 KB
testcase_15 AC 35 ms
53,956 KB
testcase_16 AC 82 ms
79,596 KB
testcase_17 AC 61 ms
73,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n, k = na()
r,g,b = 0,0,0
def f(x):return int(x[0]),x[1]
d = [None]*((n+2)//3*3)
for i in range(k):
    a,c = f(input().split())
    d[a-1] = c

ans = [None]*((n+2)//3*3)
for i in range((2+n)//3):
    x,y,z = None,None,None

    x = d[i*3]
    if x == None:
        x = "G"
    if d[i*3+1] != None and d[i * 3 + 1] != x:
        y = d[i*3 + 1]
    elif x == "G":
        y = "B"
    else:
        y = "G"
    p = ["R","G","B"]
    p.remove(x)
    p.remove(y)
    z = p[0]
    ans[i*3],ans[i*3+1],ans[i*3+2] = x,y,z
print("".join(ans[:n]))
0