結果

問題 No.1564 Sum of Products of Pairs
ユーザー irumo8202irumo8202
提出日時 2022-02-17 22:38:21
言語 TypeScript
(5.4.3)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 7,499 ms
コンパイル使用メモリ 255,480 KB
実行使用メモリ 72,592 KB
最終ジャッジ日時 2023-09-11 17:54:39
合計ジャッジ時間 17,530 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
42,192 KB
testcase_01 AC 75 ms
44,236 KB
testcase_02 AC 76 ms
42,224 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 74 ms
42,076 KB
testcase_15 WA -
testcase_16 AC 75 ms
42,080 KB
testcase_17 AC 76 ms
44,176 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 75 ms
42,324 KB
testcase_29 AC 75 ms
42,200 KB
testcase_30 AC 75 ms
42,088 KB
testcase_31 AC 74 ms
42,224 KB
testcase_32 AC 75 ms
42,080 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()
    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