結果

問題 No.1564 Sum of Products of Pairs
ユーザー AsahiAsahi
提出日時 2023-02-04 19:06:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,008 bytes
コンパイル時間 2,861 ms
コンパイル使用メモリ 75,932 KB
実行使用メモリ 66,792 KB
最終ジャッジ日時 2023-09-16 15:36:59
合計ジャッジ時間 20,829 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,900 KB
testcase_01 AC 126 ms
55,936 KB
testcase_02 AC 125 ms
55,852 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 AC 124 ms
55,728 KB
testcase_14 AC 127 ms
55,988 KB
testcase_15 AC 126 ms
55,492 KB
testcase_16 AC 124 ms
55,712 KB
testcase_17 AC 125 ms
55,668 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 126 ms
55,844 KB
testcase_29 AC 125 ms
55,668 KB
testcase_30 WA -
testcase_31 AC 126 ms
55,656 KB
testcase_32 AC 125 ms
55,728 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 += A[2*i]*A[(2*i)+1];
        }
        output.print(ans);
        output.flush();
    }
}
0