結果

問題 No.1564 Sum of Products of Pairs
ユーザー fukafukatanifukafukatani
提出日時 2021-07-13 23:06:40
言語 Scala(Beta)
(3.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 317 bytes
コンパイル時間 11,370 ms
コンパイル使用メモリ 266,728 KB
実行使用メモリ 121,372 KB
最終ジャッジ日時 2023-09-15 15:48:15
合計ジャッジ時間 63,878 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 979 ms
63,668 KB
testcase_01 AC 968 ms
63,740 KB
testcase_02 AC 964 ms
63,736 KB
testcase_03 AC 1,710 ms
85,352 KB
testcase_04 AC 1,253 ms
68,244 KB
testcase_05 AC 1,822 ms
93,888 KB
testcase_06 AC 1,646 ms
88,792 KB
testcase_07 AC 1,514 ms
76,796 KB
testcase_08 AC 1,357 ms
71,572 KB
testcase_09 AC 1,545 ms
80,076 KB
testcase_10 AC 1,823 ms
95,172 KB
testcase_11 AC 1,842 ms
109,500 KB
testcase_12 AC 1,682 ms
87,872 KB
testcase_13 AC 955 ms
63,624 KB
testcase_14 AC 959 ms
63,672 KB
testcase_15 AC 963 ms
64,012 KB
testcase_16 AC 955 ms
63,660 KB
testcase_17 AC 964 ms
63,964 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 1,999 ms
114,616 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 AC 950 ms
64,164 KB
testcase_29 AC 956 ms
63,692 KB
testcase_30 AC 951 ms
63,812 KB
testcase_31 AC 955 ms
63,664 KB
testcase_32 AC 957 ms
63,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val p = Array.fill(2 * n)(sc.nextLong).sorted
  val e = p.zipWithIndex.filter(_._2 % 2 == 0).map(_._1)
  val o = p.zipWithIndex.filter(_._2 % 2 == 1).map(_._1)
  val ans = e.zip(o).map(p => p._1 * p._2).sum
  println(ans)
}
0