結果

問題 No.2460 #強調#
ユーザー InTheBloomInTheBloom
提出日時 2023-09-08 21:24:34
言語 D
(dmd 2.106.1)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 424 bytes
コンパイル時間 2,790 ms
コンパイル使用メモリ 164,992 KB
最終ジャッジ日時 2024-06-26 14:13:40
合計ジャッジ時間 3,161 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(1469): Error: cannot modify `immutable` expression `target`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(1265): Error: template instance `std.algorithm.mutation.moveEmplaceImpl!(immutable(char))` error instantiating
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(1190):        instantiated from here: `moveImpl!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(223):        instantiated from here: `move!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(761):        instantiated from here: `createNode!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(461):        instantiated from here: `insertBeforeNode!(immutable(char))`
Main.d(7):        instantiated from here: `insertBack!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(1267): Error: template instance `std.algorithm.mutation.trustedMoveImpl!(immutable(char))` error instantiating
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(1190):        instantiated from here: `moveImpl!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(223):        instantiated from here: `move!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(761):        instantiated from here: `createNode!(immutable(char))`
/home/linuxbrew/.linuxbrew/opt/dmd/include/dlang/dmd/std/container/dlist.d(461):        instantiated from here: `insertBeforeNode!(immutable(char))`
Main.d(7):        instantiated from here: `insertBack!(immutable(char))`

ソースコード

diff #

import std;

void main () {
    string S = readln.chomp;
    DList!char Q;
    foreach (c; S) {
        Q.insertBack(c);
    }

    void rev (ref bool x) {
        x = x ? false : true;
    }

    bool isInc = false;

    while (!Q.empty) {
        auto head = Q.front; Q.removeFront;
        if (head == '#') {
           rev(isInc);
           continue;
        }

        if (isInc) write(head);
    }
    write("\n");
}
0