結果

問題 No.1159 Sashiming String
ユーザー kokatsu
提出日時 2022-11-03 22:14:58
言語 D
(dmd 2.112.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
結果
WA  
実行時間 -
コード長 380 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,418 ms
コンパイル使用メモリ 191,200 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-06 22:11:07
合計ジャッジ時間 2,765 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std;

void main() {
    string S;
    readf("%s\n", S);

    auto len = S.length.to!int;
    uint[] F, B;
    foreach (i; 0 .. len-2) {
        if (S[i] == 'S') F ~= i;
        if (S[i..i+3] == "ing") B ~= i;
    }

    auto b = B.assumeSorted;

    int res;
    foreach (f; F) {
        auto ub = b.upperBound(f);
        res += ub.length.to!int;
    }

    res.writeln;
}
0