結果
| 問題 | No.3323 岩井星式ジャンケン |
| コンテスト | |
| ユーザー |
Prala
|
| 提出日時 | 2025-11-01 15:23:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,762 bytes |
| コンパイル時間 | 330 ms |
| コンパイル使用メモリ | 82,184 KB |
| 実行使用メモリ | 80,272 KB |
| 最終ジャッジ日時 | 2025-11-01 15:23:28 |
| 合計ジャッジ時間 | 3,310 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 6 |
ソースコード
import sys
sys.setrecursionlimit(5*10**7)
import math
import bisect
import heapq
from collections import deque, defaultdict
import random
import itertools
#from decimal import Decimal
#from copy import copy, deepcopy
#from sortedcontainers import SortedList
# -------------------------------------------------
pin = sys.stdin.readline
def ST(): return pin().rstrip()
def IN(): return int(pin())
def IM(): return map(int, pin().split())
def IL(): return list(IM())
def SR(n:int)->list: return [pin().rstrip() for _ in range(n)]
def IMatrix(n:int)->list: return [IL() for _ in range(n)]
INF = 2*10**18+1
mod = 998244353
# -------------------------------------------------
#import pypyjit
#pypyjit.set_param("max_unroll_recursion=-1")
N, M = IM()
S = SR(N)
ans = []
win = [0]*N
for j in range(M):
s = set()
for i in range(N):
if win[i]:
continue
s.add(S[i][j])
#print(ans , s)
if len(s) == 3:
print(-1)
exit()
elif len(s) == 1:
if "G" in s:
ans.append("P")
elif "C" in s:
ans.append("G")
else:
ans.append("C")
for _ in range(M-j-1):
ans.append("G")
print("".join(ans))
exit()
else:
if not 'G' in s:
ans.append("C")
for i in range(N):
if not win[i] and S[i][j] == "P":
win[i] = 1
elif not "C" in s:
ans.append("P")
for i in range(N):
if not win[i] and S[i][j] == "G":
win[i] = 1
else:
ans.append("G")
for i in range(N):
if not win[i] and S[i][j] == "C":
win[i] = 1
print("".join(ans))
Prala