結果
問題 | No.2042 RGB Caps |
ユーザー | asumo0729 |
提出日時 | 2022-09-19 16:21:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 239 ms / 2,000 ms |
コード長 | 1,355 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 87,248 KB |
実行使用メモリ | 92,308 KB |
最終ジャッジ日時 | 2023-08-23 18:57:28 |
合計ジャッジ時間 | 5,629 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 107 ms
72,416 KB |
testcase_01 | AC | 105 ms
72,672 KB |
testcase_02 | AC | 108 ms
72,728 KB |
testcase_03 | AC | 108 ms
72,636 KB |
testcase_04 | AC | 106 ms
72,736 KB |
testcase_05 | AC | 105 ms
72,456 KB |
testcase_06 | AC | 214 ms
83,280 KB |
testcase_07 | AC | 172 ms
83,308 KB |
testcase_08 | AC | 204 ms
88,380 KB |
testcase_09 | AC | 156 ms
79,392 KB |
testcase_10 | AC | 236 ms
91,684 KB |
testcase_11 | AC | 154 ms
80,716 KB |
testcase_12 | AC | 239 ms
92,296 KB |
testcase_13 | AC | 239 ms
92,308 KB |
testcase_14 | AC | 238 ms
92,284 KB |
testcase_15 | AC | 109 ms
72,468 KB |
testcase_16 | AC | 171 ms
82,540 KB |
testcase_17 | AC | 154 ms
79,164 KB |
ソースコード
import sys from operator import itemgetter from collections import defaultdict, deque import heapq from heapq import heapify, heappop, _heapify_max, heappush from bisect import bisect_left, bisect_right import math import itertools import copy stdin=sys.stdin #sys.setrecursionlimit(10 ** 7) #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') ip=lambda: int(sp()) fp=lambda: float(sp()) lp=lambda:list(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() Yp=lambda:print('Yes') Np=lambda:print('No') inf = 1 << 60 mod = 10 ** 9 + 7 mod = 998244353 eps = 1e-9 sortkey1 = itemgetter(0) sortkey2 = lambda x: (x[0], x[1]) # sort(key=lambda x:(x[1], x[2])) ############################################################### N, K = lp() A = [-1 for _ in range(N)] for _ in range(K): a, c = input().split() a = int(a) - 1 A[a] = c ans = [] RGB = 'RGB' for i in range(N): if i % 3 == 0: s = 'R' if A[i] == -1 else A[i] ans.append(s) elif i % 3 == 1: s = 'R' if A[i] == -1 else A[i] if ans[-1] == s: for t in RGB: if t != s: s = t break ans.append(s) else: ss = ans[-1] + ans[-2] for t in RGB: if t not in ss: s = t ans.append(s) print(''.join(ans))