結果

問題 No.290 1010
ユーザー MamonboMamonbo
提出日時 2015-10-29 13:30:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 573 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,484 KB
実行使用メモリ 10,132 KB
最終ジャッジ日時 2023-10-11 05:08:57
合計ジャッジ時間 1,579 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,796 KB
testcase_02 AC 16 ms
7,928 KB
testcase_03 AC 16 ms
7,816 KB
testcase_04 AC 16 ms
7,936 KB
testcase_05 AC 16 ms
7,844 KB
testcase_06 AC 16 ms
7,752 KB
testcase_07 AC 16 ms
7,736 KB
testcase_08 AC 16 ms
7,844 KB
testcase_09 AC 16 ms
7,780 KB
testcase_10 AC 16 ms
7,732 KB
testcase_11 AC 16 ms
7,808 KB
testcase_12 AC 16 ms
7,784 KB
testcase_13 AC 16 ms
7,784 KB
testcase_14 AC 16 ms
7,848 KB
testcase_15 AC 15 ms
7,848 KB
testcase_16 AC 16 ms
7,924 KB
testcase_17 AC 16 ms
7,916 KB
testcase_18 AC 16 ms
7,736 KB
testcase_19 AC 16 ms
7,812 KB
testcase_20 AC 20 ms
10,036 KB
testcase_21 AC 20 ms
10,132 KB
testcase_22 AC 20 ms
10,064 KB
testcase_23 AC 19 ms
9,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8
N=int(input())
S=input()

#NOなやつらについて
#まず幅1の繰り返しを持たないので
#0101... or 10101... という形になる
#N>=4のときは幅2の繰り返しを持つ(01と10)
#ゆえにN=1のときの全てとN=2のときの10と01
#N=3のときの101と010に限る

if N>=4:
    print('YES')
elif N==1:
    print('NO')
else:
    #N=2,3のときは幅1のだけ調べればよい
    for idx in range(0,N-1,1):
        if S[idx]==S[idx+1]:
            print('YES')
            break
    else:#マイナー文法
        print('NO')

0