結果

問題 No.1564 Sum of Products of Pairs
ユーザー kokatsukokatsu
提出日時 2022-02-22 22:08:56
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 219 bytes
コンパイル時間 1,916 ms
コンパイル使用メモリ 208,136 KB
実行使用メモリ 12,196 KB
最終ジャッジ日時 2023-09-04 16:07:24
合計ジャッジ時間 5,535 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 27 ms
7,192 KB
testcase_04 AC 4 ms
4,384 KB
testcase_05 AC 36 ms
9,236 KB
testcase_06 AC 27 ms
7,984 KB
testcase_07 AC 17 ms
7,584 KB
testcase_08 AC 9 ms
4,492 KB
testcase_09 AC 19 ms
6,140 KB
testcase_10 AC 37 ms
7,912 KB
testcase_11 AC 41 ms
9,088 KB
testcase_12 AC 28 ms
7,252 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 55 ms
12,196 KB
testcase_19 AC 53 ms
10,908 KB
testcase_20 AC 56 ms
11,888 KB
testcase_21 AC 57 ms
11,004 KB
testcase_22 AC 53 ms
10,904 KB
testcase_23 AC 57 ms
11,064 KB
testcase_24 AC 57 ms
11,036 KB
testcase_25 AC 58 ms
10,936 KB
testcase_26 AC 57 ms
11,004 KB
testcase_27 AC 57 ms
10,940 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    auto A = readln.chomp.split.to!(long[]);

    A.sort;

    long res;
    foreach (i; 0 .. N) {
        res += A[i*2] * A[i*2+1];
    }

    res.writeln;
}
0