結果

問題 No.2343 (l+r)/2
ユーザー yosupotyosupot
提出日時 2023-07-01 02:52:29
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 17,875 ms
コンパイル使用メモリ 677,952 KB
実行使用メモリ 9,252 KB
最終ジャッジ日時 2023-09-21 20:33:00
合計ジャッジ時間 15,067 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,332 KB
testcase_01 AC 276 ms
4,488 KB
testcase_02 AC 5 ms
4,356 KB
testcase_03 AC 55 ms
4,504 KB
testcase_04 AC 12 ms
9,252 KB
testcase_05 AC 6 ms
5,296 KB
testcase_06 AC 5 ms
4,796 KB
testcase_07 AC 10 ms
7,120 KB
testcase_08 AC 12 ms
6,868 KB
testcase_09 AC 10 ms
6,364 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 11 ms
6,496 KB
testcase_12 AC 9 ms
7,224 KB
testcase_13 AC 7 ms
5,304 KB
testcase_14 AC 13 ms
6,828 KB
権限があれば一括ダウンロードができます

ソースコード

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 = ctRegex!(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