結果

問題 No.2234 palindromer
ユーザー tktk_snsntktk_snsn
提出日時 2023-03-03 21:39:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 1,169 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,516 KB
実行使用メモリ 73,296 KB
最終ジャッジ日時 2023-10-18 01:36:37
合計ジャッジ時間 2,267 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
73,296 KB
testcase_01 AC 76 ms
73,296 KB
testcase_02 AC 75 ms
73,296 KB
testcase_03 AC 75 ms
73,296 KB
testcase_04 AC 76 ms
73,296 KB
testcase_05 AC 75 ms
73,296 KB
testcase_06 AC 76 ms
73,296 KB
testcase_07 AC 75 ms
73,296 KB
testcase_08 AC 74 ms
73,296 KB
testcase_09 AC 74 ms
73,296 KB
testcase_10 AC 75 ms
73,296 KB
testcase_11 AC 74 ms
73,296 KB
testcase_12 AC 75 ms
73,296 KB
testcase_13 AC 75 ms
73,296 KB
testcase_14 AC 75 ms
73,296 KB
testcase_15 AC 75 ms
73,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import os
import inspect
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 18

if os.getenv("TKTKLOCAL", False):
    def debug(*arg, sep=" ", end="\n"):
        print(*arg, sep=sep, end=end, file=sys.stderr)

    def debug_indent(*arg, sep=" ", end="\n", indent="    "):
        frame = inspect.currentframe().f_back
        par_func = inspect.getframeinfo(frame).function
        if par_func == "<module>":
            debug(*arg, sep=sep, end=end)
            return

        frame_stack = inspect.stack()
        if len(frame_stack) > 30:
            return

        depth = sum(f.function == par_func for f in frame_stack)
        debug(indent * (depth - 1), end="")
        debug(*arg, sep=sep, end=end)
else:
    def debug(*arg, **kwarg):
        pass

    def debug_indent(*arg, **kwarg):
        pass


def is_pari(s):
    return s == s[::-1]


def solve():
    S = input().rstrip()
    N = len(S)

    for i in range(N+1):
        if is_pari(S[i:N]):
            answer = (
                S[0:i],
                S[i:N],
                S[0:i][::-1],
            )
            print("".join(answer))
            return


solve()
0