結果

問題 No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn
ユーザー tamatotamato
提出日時 2020-04-01 22:10:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,284 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 71,564 KB
最終ジャッジ日時 2023-09-09 18:28:58
合計ジャッジ時間 3,080 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,400 KB
testcase_01 AC 72 ms
71,264 KB
testcase_02 AC 70 ms
71,132 KB
testcase_03 AC 70 ms
71,268 KB
testcase_04 AC 73 ms
71,376 KB
testcase_05 AC 71 ms
71,528 KB
testcase_06 AC 72 ms
71,280 KB
testcase_07 AC 71 ms
71,248 KB
testcase_08 AC 72 ms
71,392 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 72 ms
71,320 KB
testcase_14 WA -
testcase_15 AC 71 ms
71,196 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 72 ms
71,412 KB
testcase_20 AC 71 ms
71,316 KB
testcase_21 AC 72 ms
71,376 KB
testcase_22 AC 71 ms
71,236 KB
testcase_23 AC 72 ms
71,284 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()
    if len(exist) == 1:
        if exist[0] != N-1:
            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()
    if len(exist) == 1:
        if exist[0] != N-1:
            print('Yes')
            exit()

    print('NO')


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