hiro1729
@hiro1729

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

AtCoder PAST03 F問題

この問題です。
Pythonの以下の提出で、1ケースだけREになります。

n = int(input())
if n == 1: print(input())
a = [list(input()) for _ in range(n)]
s = ""
if n % 2: s = a[n // 2][0]
for i in range(n // 2 - 1, -1, -1):
  t = list(set(a[i]) & set(a[n - i - 1]))
  if len(t) == 0: exit(print(-1))
  s = t[0] + s + t[0]
print(s)

原因が全く分かりません。わかる人教えてください。

0

1Answer

Your answer might help someone💌