結果
問題 | No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn |
ユーザー | tamato |
提出日時 | 2020-04-01 22:10:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,284 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 54,260 KB |
最終ジャッジ日時 | 2024-06-27 11:05:04 |
合計ジャッジ時間 | 1,886 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
54,080 KB |
testcase_01 | AC | 37 ms
52,956 KB |
testcase_02 | AC | 37 ms
52,484 KB |
testcase_03 | AC | 38 ms
52,820 KB |
testcase_04 | AC | 36 ms
52,452 KB |
testcase_05 | AC | 38 ms
53,660 KB |
testcase_06 | AC | 37 ms
52,272 KB |
testcase_07 | AC | 37 ms
52,948 KB |
testcase_08 | AC | 36 ms
52,544 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 37 ms
52,888 KB |
testcase_14 | WA | - |
testcase_15 | AC | 37 ms
52,828 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 37 ms
53,072 KB |
testcase_20 | AC | 36 ms
53,224 KB |
testcase_21 | AC | 37 ms
53,288 KB |
testcase_22 | AC | 38 ms
52,568 KB |
testcase_23 | AC | 37 ms
53,552 KB |
ソースコード
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()