結果
| 問題 | No.3323 岩井星式ジャンケン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-20 09:34:58 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 639 bytes |
| 記録 | |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 82,200 KB |
| 実行使用メモリ | 87,928 KB |
| 最終ジャッジ日時 | 2026-01-20 09:35:03 |
| 合計ジャッジ時間 | 4,080 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 6 |
ソースコード
N, M = map(int, input().split())
S = [input() for _ in range(N)]
fin = set()
H = "GCPG"
def next_h(c):
return H[H.index(c) + 1]
ans = []
for k in range(M):
hand_tmp = {'G', 'C', 'P'}
for i in range(N):
if i in fin:
continue
hand_tmp.discard(next_h(S[i][k]))
match len(hand_tmp):
case 0:
print(-1)
exit()
case 1:
hand = hand_tmp.pop()
case 2:
hand = next_h([h for h in H if h not in hand_tmp].pop())
for i in range(N):
if S[i][k] == next_h(hand):
fin.add(i)
ans.append(hand)
print(*ans, sep='')