結果

問題 No.904 サメトロ
コンテスト
ユーザー nebukuro09
提出日時 2019-10-11 21:25:46
言語 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  
実行時間 -
コード長 466 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 682 ms
コンパイル使用メモリ 101,308 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-06 08:04:32
合計ジャッジ時間 1,948 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 = iota(N-1).map!(_ => readln.split.map!(to!int).array).array;

    auto x = A.map!(a => a[0]).sum;
    auto y = A.map!(a => a[1]).sum;

    int ub = y;
    int lb = max(0, y - x);

    writeln(ub - lb + 1);
}
0