結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー InTheBloom
提出日時 2025-03-21 21:28:03
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 1,782 ms
コンパイル使用メモリ 163,924 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 21:28:09
合計ジャッジ時間 3,156 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main () {
    int N = readln.chomp.to!int;
    auto c = readln.split.to!(long[]);

    long m = min(c[0], 0);
    long p = max(c[$ - 1], 0);

    long ans = 2 * (abs(m) + abs(p));
    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