結果

問題 No.2343 (l+r)/2
ユーザー yosupotyosupot
提出日時 2023-07-01 02:50:54
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 9,551 ms
コンパイル使用メモリ 299,092 KB
実行使用メモリ 5,480 KB
最終ジャッジ日時 2024-07-07 13:59:02
合計ジャッジ時間 10,806 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.string, std.regex, std.conv;
 

void solve() {
    int n = to!int(readln.strip);
    string s = readln.strip.split.join;

    auto r = regex(r"^((0+1+|1+0+)*)((0+1+0+1+0+1+0+1+0+)|(1+0+1+0+1+0+1+0+1+)|)$");
 
    if (s.matchFirst(r)) {
        writeln("Yes");
    } else {
        writeln("No");
    }    
}

void main() {
    int t = to!int(readln.strip);
    foreach (i; 0..t) {
        solve();
    } 
}
0