結果

問題 No.1564 Sum of Products of Pairs
ユーザー AsahiAsahi
提出日時 2023-02-04 19:07:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 776 ms / 2,000 ms
コード長 1,014 bytes
コンパイル時間 3,572 ms
コンパイル使用メモリ 75,744 KB
実行使用メモリ 67,168 KB
最終ジャッジ日時 2023-09-16 15:38:32
合計ジャッジ時間 19,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,404 KB
testcase_01 AC 127 ms
55,752 KB
testcase_02 AC 123 ms
55,724 KB
testcase_03 AC 526 ms
60,836 KB
testcase_04 AC 255 ms
60,212 KB
testcase_05 AC 581 ms
62,808 KB
testcase_06 AC 524 ms
60,712 KB
testcase_07 AC 433 ms
60,532 KB
testcase_08 AC 345 ms
60,740 KB
testcase_09 AC 444 ms
60,828 KB
testcase_10 AC 617 ms
63,236 KB
testcase_11 AC 612 ms
64,240 KB
testcase_12 AC 518 ms
60,672 KB
testcase_13 AC 123 ms
53,396 KB
testcase_14 AC 125 ms
55,424 KB
testcase_15 AC 124 ms
55,896 KB
testcase_16 AC 123 ms
55,652 KB
testcase_17 AC 122 ms
55,780 KB
testcase_18 AC 726 ms
64,732 KB
testcase_19 AC 686 ms
64,560 KB
testcase_20 AC 743 ms
64,792 KB
testcase_21 AC 749 ms
65,640 KB
testcase_22 AC 696 ms
64,968 KB
testcase_23 AC 765 ms
65,164 KB
testcase_24 AC 776 ms
67,168 KB
testcase_25 AC 753 ms
64,944 KB
testcase_26 AC 756 ms
65,436 KB
testcase_27 AC 760 ms
64,928 KB
testcase_28 AC 123 ms
55,732 KB
testcase_29 AC 123 ms
55,792 KB
testcase_30 AC 124 ms
55,912 KB
testcase_31 AC 125 ms
55,940 KB
testcase_32 AC 124 ms
55,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;

public class Main{
    /* 入出力 */
    static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static PrintWriter output = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    /* 定数 */
    static final int [] y4 = {0,1,0,-1};
    static final int [] x4 = {1,0,-1,0};
    static final int  INF1 = Integer.MAX_VALUE;
    static final long INF2 = Long.MAX_VALUE;
    static final long MOD1 = (long)1e9+7;
    static final long MOD2 = 998244353;
    /* Main */
    public static void main(String[] args) throws IOException{
        int n = sc.nextInt();
        int [] A = new int[2*n];
        for(int i=0;i<2*n;i++) A[i] = sc.nextInt();
        Arrays.sort(A);
        long ans = 0;
        for(int i=0;i<n;i++) {
            ans += (long)A[2*i]*A[(2*i)+1];
        }
        output.print(ans);
        output.flush();
    }
}
0