結果

問題 No.3288 Sloppy Land Grading
コンテスト
ユーザー 13d0ccc0-b63b-11f0-9490-db448702d40f
提出日時 2025-11-01 19:21:37
言語 TypeScript
(5.7.2)
結果
WA  
実行時間 -
コード長 2,004 bytes
コンパイル時間 12,698 ms
コンパイル使用メモリ 265,976 KB
実行使用メモリ 107,448 KB
最終ジャッジ日時 2025-11-01 19:21:59
合計ジャッジ時間 15,298 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from 'fs';

let inputs = '';
let inputArray: string[];
let currentIndex = 0;

let outputBuffer = '';

function next() {
    return inputArray[currentIndex++];
}
function nextNum() {
    return +next();
}
function nextBigInt() {
    return BigInt(next());
}
function nexts(length: number) {
    const arr = [];
    for (let i = 0; i < length; ++i) arr[i] = next();
    return arr;
}
function nextNums(length: number) {
    const arr = [];
    for (let i = 0; i < length; ++i) arr[i] = nextNum();
    return arr;
}
function nextBigInts(length: number) {
    const arr = [];
    for (let i = 0; i < length; ++i) arr[i] = nextBigInt();
    return arr;
}

function print(out: string | number | bigint): void;
function print<T>(out: Array<T>, separator: string): void;
function print<T>(out: string | number | bigint | Array<T>, separator?: string) {
    if (Array.isArray(out)) {
        outputBuffer += out.join(separator);
    } else {
        outputBuffer += out;
    }
}

function println(out: string | number | bigint): void;
function println<T>(out: Array<T>, separator: string): void;
function println<T>(out: string | number | bigint | Array<T>, separator?: string) {
    if (Array.isArray(out)) {
        print(out, separator || '');
    } else {
        print(out);
    }
    print('\n');
}

function flush() {
    console.log(outputBuffer);
}

function getMin(x: BigInt, y: BigInt): BigInt {
    if (x > y) {
        return y;
    } else {
        return x;
    }
}

inputs = fs.readFileSync('/dev/stdin', 'utf8');
inputArray = inputs.split(/\s/);
main();
flush();

function main() {
    const t = nextNum();
    for (let index = 0; index < t; index++) {
        const [a, b, c, x, y, z] = nextNums(6);
        const posa = BigInt(Math.abs(b - a) * y + Math.abs(c - a) * z);
        const posb = BigInt(Math.abs(b - a) * x + Math.abs(c - b) * z);
        const posc = BigInt(Math.abs(c - a) * x + Math.abs(c - b) * y);
        print(`${getMin(posa, getMin(posb, posc))}\n`);
    }
}
0