結果

問題 No.1564 Sum of Products of Pairs
ユーザー irumo8202irumo8202
提出日時 2022-02-17 22:41:08
言語 TypeScript
(5.4.3)
結果
AC  
実行時間 393 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 8,575 ms
コンパイル使用メモリ 252,876 KB
実行使用メモリ 71,728 KB
最終ジャッジ日時 2023-09-11 17:54:56
合計ジャッジ時間 17,082 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
42,272 KB
testcase_01 AC 82 ms
42,144 KB
testcase_02 AC 80 ms
42,144 KB
testcase_03 AC 221 ms
54,060 KB
testcase_04 AC 94 ms
44,360 KB
testcase_05 AC 273 ms
62,724 KB
testcase_06 AC 219 ms
53,984 KB
testcase_07 AC 165 ms
50,628 KB
testcase_08 AC 128 ms
47,816 KB
testcase_09 AC 176 ms
52,056 KB
testcase_10 AC 281 ms
60,504 KB
testcase_11 AC 308 ms
65,964 KB
testcase_12 AC 228 ms
57,500 KB
testcase_13 AC 80 ms
42,412 KB
testcase_14 AC 80 ms
42,140 KB
testcase_15 AC 81 ms
42,216 KB
testcase_16 AC 78 ms
42,144 KB
testcase_17 AC 79 ms
42,220 KB
testcase_18 AC 381 ms
71,692 KB
testcase_19 AC 365 ms
66,584 KB
testcase_20 AC 384 ms
71,728 KB
testcase_21 AC 392 ms
70,012 KB
testcase_22 AC 364 ms
66,612 KB
testcase_23 AC 391 ms
68,500 KB
testcase_24 AC 391 ms
68,608 KB
testcase_25 AC 390 ms
68,912 KB
testcase_26 AC 388 ms
68,684 KB
testcase_27 AC 393 ms
68,232 KB
testcase_28 AC 79 ms
42,292 KB
testcase_29 AC 79 ms
42,144 KB
testcase_30 AC 78 ms
42,272 KB
testcase_31 AC 78 ms
42,264 KB
testcase_32 AC 79 ms
42,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from "fs"

const main = (args: string): void => {
    const input = args.trim().split("\n");
    const N = parseInt(input.shift())
    const A = input.shift().split(" ").map(x => Number(x))
    A.sort((x, y) => x > y ? -1 : 1)
    let ans = BigInt(0)

    for (let i = 0; i < 2 * N; i += 2) {
        ans += BigInt(A[i] * A[i + 1])
    }
    console.log(String(ans))
}

main(fs.readFileSync('/dev/stdin', 'utf8'));

function apply<T, R>(value: T, func: (arg: T) => R): R {
    return func(value)
}
0