結果

問題 No.1564 Sum of Products of Pairs
ユーザー 👑 kakel-sankakel-san
提出日時 2024-03-14 23:07:51
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 396 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 15,100 ms
コンパイル使用メモリ 158,952 KB
実行使用メモリ 180,240 KB
最終ジャッジ日時 2024-03-14 23:08:17
合計ジャッジ時間 17,117 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
32,804 KB
testcase_01 AC 82 ms
32,804 KB
testcase_02 AC 80 ms
32,804 KB
testcase_03 AC 221 ms
40,228 KB
testcase_04 AC 102 ms
33,956 KB
testcase_05 AC 299 ms
46,928 KB
testcase_06 AC 217 ms
39,972 KB
testcase_07 AC 167 ms
37,412 KB
testcase_08 AC 129 ms
35,364 KB
testcase_09 AC 175 ms
37,668 KB
testcase_10 AC 280 ms
47,328 KB
testcase_11 AC 319 ms
42,916 KB
testcase_12 AC 228 ms
40,612 KB
testcase_13 AC 85 ms
32,804 KB
testcase_14 AC 83 ms
32,804 KB
testcase_15 AC 83 ms
32,804 KB
testcase_16 AC 83 ms
32,804 KB
testcase_17 AC 85 ms
32,804 KB
testcase_18 AC 387 ms
45,952 KB
testcase_19 AC 347 ms
45,332 KB
testcase_20 AC 363 ms
45,956 KB
testcase_21 AC 396 ms
46,276 KB
testcase_22 AC 345 ms
45,316 KB
testcase_23 AC 372 ms
46,288 KB
testcase_24 AC 388 ms
46,288 KB
testcase_25 AC 365 ms
46,288 KB
testcase_26 AC 366 ms
46,288 KB
testcase_27 AC 368 ms
46,288 KB
testcase_28 AC 86 ms
32,804 KB
testcase_29 AC 83 ms
32,804 KB
testcase_30 AC 83 ms
32,804 KB
testcase_31 AC 86 ms
32,804 KB
testcase_32 AC 83 ms
180,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (116 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray();
    static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        Array.Sort(a);
        var ans = 0L;
        for (var i = 0; i < a.Length; i += 2)
        {
            ans += (long)a[i] * a[i + 1];
        }
        WriteLine(ans);
    }
}
0