結果

問題 No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn
ユーザー tamatotamato
提出日時 2020-04-01 22:08:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,092 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 86,480 KB
実行使用メモリ 71,312 KB
最終ジャッジ日時 2023-09-09 18:25:24
合計ジャッジ時間 3,391 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,116 KB
testcase_01 AC 75 ms
71,092 KB
testcase_02 AC 70 ms
71,244 KB
testcase_03 AC 72 ms
71,276 KB
testcase_04 AC 71 ms
71,032 KB
testcase_05 AC 72 ms
70,976 KB
testcase_06 AC 71 ms
71,256 KB
testcase_07 AC 72 ms
71,228 KB
testcase_08 AC 71 ms
71,204 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 71 ms
70,960 KB
testcase_14 WA -
testcase_15 AC 71 ms
71,080 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 70 ms
71,160 KB
testcase_20 AC 72 ms
71,196 KB
testcase_21 AC 73 ms
71,312 KB
testcase_22 AC 72 ms
71,028 KB
testcase_23 AC 71 ms
71,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline

    S = input().rstrip('\n')
    N = len(S)

    seen = set()
    new = [s for s in S]
    for i in range(0, N, 2):
        seen.add(S[i])
        new[i] = ' '
    for i in range(1, N, 2):
        if S[i] in seen:
            new[i] = ' '
    exist = []
    for i in range(N):
        if new[i] != ' ':
            exist.append(i)
    if len(exist) >= 2:
        diff = [exist[i+1] - exist[i] for i in range(len(exist) - 1)]
        if min(diff) == max(diff) == 2:
            print('Yes')
            exit()

    seen = set()
    new = [s for s in S]
    for i in range(1, N, 2):
        seen.add(S[i])
        new[i] = ' '
    for i in range(0, N, 2):
        if S[i] in seen:
            new[i] = ' '
    exist = []
    for i in range(N):
        if new[i] != ' ':
            exist.append(i)
    if len(exist) >= 2:
        diff = [exist[i + 1] - exist[i] for i in range(len(exist) - 1)]
        if min(diff) == max(diff) == 2:
            print('Yes')
            exit()

    print('NO')


if __name__ == '__main__':
    main()
0