結果

問題 No.3796 Fanmade Tile Distance
ユーザー atcoder8
提出日時 2026-11-13 23:02:39
言語 Rust
(1.99.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 60 ms / 2,000 ms
+ 205µs
コード長 476 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,031 ms
コンパイル使用メモリ 175,488 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-11-13 23:02:59
合計ジャッジ時間 6,547 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use itertools::Itertools;
use proconio::input;

fn main() {
    input! {
        q: usize,
    }

    let output = (0..q).map(|_| solve()).join("\n");
    println!("{output}");
}

fn div(a: i64, b: i64) -> i64 {
    if a >= 0 {
        a / b
    } else {
        a / b - (a % b != 0) as i64
    }
}

fn solve() -> u64 {
    input! {
        (a, b, sx, sy, tx, ty): (i64, i64, i64, i64, i64, i64),
    }

    div(sx, a).abs_diff(div(tx, a)) + div(sy, b).abs_diff(div(ty, b))
}
0