結果

問題 No.3061 Cut and Maximums
ユーザー gew1fw
提出日時 2025-06-12 14:44:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,052 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 54,292 KB
最終ジャッジ日時 2025-06-12 14:45:23
合計ジャッジ時間 3,548 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()

n = len(S)
found = False

for start in range(n):
    for end in range(start, n):
        length = end - start + 1
        if length % 2 != 0 or length < 2:
            continue
        
        valid = True
        ev_letters = set()
        for i in range(0, length, 2):
            pos = start + i
            if pos >= n or S[pos] == ' ':
                valid = False
                break
            ev_letters.add(S[pos])
        if not valid:
            continue
        
        R = set()
        for i in range(1, length, 2):
            pos = start + i
            if pos >= n:
                valid = False
                break
            if S[pos] != ' ':
                R.add(S[pos])
        if not valid:
            continue
        
        for i in range(n):
            if i < start or i > end:
                if S[i] != ' ':
                    R.add(S[i])
        
        if ev_letters.isdisjoint(R):
            found = True
            break
    if found:
        break

print("Yes" if found else "No")
0