結果

問題 No.290 1010
ユーザー FromBooskaFromBooska
提出日時 2023-10-03 09:22:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 525 bytes
コンパイル時間 2,408 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 78,752 KB
最終ジャッジ日時 2023-10-03 09:22:21
合計ジャッジ時間 4,086 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,284 KB
testcase_01 AC 70 ms
71,196 KB
testcase_02 AC 75 ms
71,080 KB
testcase_03 AC 73 ms
71,192 KB
testcase_04 AC 72 ms
71,328 KB
testcase_05 AC 74 ms
71,288 KB
testcase_06 AC 74 ms
71,160 KB
testcase_07 AC 73 ms
71,544 KB
testcase_08 AC 77 ms
71,320 KB
testcase_09 AC 72 ms
71,320 KB
testcase_10 AC 74 ms
71,344 KB
testcase_11 AC 72 ms
71,580 KB
testcase_12 AC 71 ms
71,384 KB
testcase_13 AC 73 ms
71,284 KB
testcase_14 AC 72 ms
71,228 KB
testcase_15 AC 73 ms
71,068 KB
testcase_16 AC 78 ms
71,068 KB
testcase_17 AC 74 ms
71,104 KB
testcase_18 AC 74 ms
71,236 KB
testcase_19 AC 76 ms
71,196 KB
testcase_20 AC 99 ms
78,752 KB
testcase_21 AC 94 ms
78,560 KB
testcase_22 AC 91 ms
78,524 KB
testcase_23 AC 92 ms
78,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 問題文表記がわかりにくい
# 1字はNo
# 2字以上は連続があればYes
# 2字以上で連続なければ010101なので、4字以上はYes
# 2字以上で連続なくて3字以下ならNo

N = int(input())
S = input()

if N == 1:
    ans = 'NO'
else:
    consec_check = False
    for i in range(1, N):
        if S[i]==S[i-1]:
            consec_check = True
    if consec_check == True:
        ans = 'YES'
    else:
        if N >= 4:
            ans = 'YES'
        else:
            ans = 'NO'
print(ans)
0