結果
| 問題 |
No.3323 岩井星式ジャンケン
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-11-02 01:17:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 793 bytes |
| コンパイル時間 | 2,091 ms |
| コンパイル使用メモリ | 82,464 KB |
| 実行使用メモリ | 350,576 KB |
| 最終ジャッジ日時 | 2025-11-02 01:17:42 |
| 合計ジャッジ時間 | 6,770 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 TLE * 1 -- * 23 |
ソースコード
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
S=[input().strip() for i in range(N)]
X=dict()
X["P"]="C"
X["G"]="P"
X["C"]="G"
L=list(range(N))
Q=[([],L,0)]
while Q:
Q.sort(key=lambda x:len(x[1]))
now,L,ind=Q.pop()
if L==[]:
while len(now)<M:
now.append("G")
print("".join(now))
exit()
if ind==M:
if L==[]:
print("".join(now))
exit()
else:
continue
for x in "PGC":
flag=1
LL=[]
for i in L:
if S[i][ind]==X[x]:
flag=0
break
if S[i][ind]==x:
LL.append(i)
if flag==1:
Q.append((now+[x],LL,ind+1))
print(-1)
titia