結果

問題 No.2298 yukicounter
コンテスト
ユーザー InTheBloom
提出日時 2026-10-15 12:30:25
言語 D
(dmd 2.113.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 5 ms / 2,000 ms
+ 939µs
コード長 764 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,831 ms
コンパイル使用メモリ 172,300 KB
実行使用メモリ 9,912 KB
最終ジャッジ日時 2026-10-15 12:30:37
合計ジャッジ時間 7,166 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std;

void main () {
    string S = readln.chomp;
    const int N = S.length.to!int;

    string y = "yukicoder";
    const int M = y.length.to!int;

    int ans = 0;
    int l = 0, r = 0;
    while (l < N) {
        int cnt = 0;
        while (r < N) {
            if (S[r .. min(N, r + M)] != y) {
                break;
            }
            cnt++;
            r += M;
        }

        ans = max(ans, cnt);

        if (l == r) {
            l++;
            r++;
        }
        else {
            l = r;
        }
    }

    writeln(ans);
}

void read (T...) (string S, ref T args) {
    import std.conv : to;
    import std.array : split;
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0