結果

問題 No.290 1010
ユーザー nanaenanae
提出日時 2017-01-06 14:09:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 599 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 10,704 KB
実行使用メモリ 10,172 KB
最終ジャッジ日時 2023-08-22 15:10:33
合計ジャッジ時間 1,738 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,892 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 15 ms
7,876 KB
testcase_03 AC 16 ms
7,956 KB
testcase_04 AC 15 ms
7,792 KB
testcase_05 AC 14 ms
7,852 KB
testcase_06 AC 14 ms
7,848 KB
testcase_07 AC 14 ms
7,800 KB
testcase_08 AC 15 ms
7,972 KB
testcase_09 AC 14 ms
7,752 KB
testcase_10 AC 14 ms
7,840 KB
testcase_11 AC 14 ms
7,788 KB
testcase_12 AC 14 ms
7,808 KB
testcase_13 AC 14 ms
7,956 KB
testcase_14 AC 14 ms
7,832 KB
testcase_15 AC 14 ms
7,848 KB
testcase_16 AC 14 ms
7,832 KB
testcase_17 AC 14 ms
7,756 KB
testcase_18 AC 14 ms
7,928 KB
testcase_19 AC 14 ms
7,796 KB
testcase_20 AC 17 ms
10,148 KB
testcase_21 AC 18 ms
10,172 KB
testcase_22 AC 18 ms
10,084 KB
testcase_23 AC 18 ms
10,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yukicoder No.290 1010

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

if N == 1: # N = 1のときは無理
    print("NO")
elif N == 2: # N = 2のときは10,01のときだけ無理
    if S == "10" or S == "01":
        print("NO")
    else:
        print("YES")
elif N == 3: # N = 3のときは101,010が無理
    if S == "101" or S == "010":
        print("NO")
    else:
        print("YES")
else: 
    # N = 4以上のときは、同じ文字が2個以上続くまたは10,01が2個以上続くといったパターンが含まれる
    # ことが避けられないので全てYESになる
    print("YES")
0