結果

問題 No.909 たぴの配置
ユーザー nebukuro09nebukuro09
提出日時 2019-10-18 21:30:07
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 121 ms / 3,000 ms
コード長 696 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 106,100 KB
実行使用メモリ 22,424 KB
最終ジャッジ日時 2023-09-04 03:02:44
合計ジャッジ時間 4,841 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 119 ms
21,064 KB
testcase_06 AC 121 ms
22,424 KB
testcase_07 AC 113 ms
21,772 KB
testcase_08 AC 117 ms
21,400 KB
testcase_09 AC 121 ms
21,108 KB
testcase_10 AC 114 ms
20,688 KB
testcase_11 AC 104 ms
14,580 KB
testcase_12 AC 119 ms
21,188 KB
testcase_13 AC 121 ms
21,528 KB
testcase_14 AC 110 ms
22,036 KB
testcase_15 AC 105 ms
14,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;
    auto B = readln.split.map!(to!int).array;

    int ans = N.iota.map!(i => A[i] + B[i]).reduce!min;
    ans.writeln;

    auto anss = new int[](N + 2);

    foreach (i; 0..N) {
        if (A[i] <= B[i]) {
            anss[i + 1] = A[i];
        } else {
            anss[i + 1] = ans - B[i];
        }
    }

    anss.back = ans;

    auto m = anss.reduce!min;

    anss.each!(a => writeln(a - m));
}
0