結果

問題 No.1792 科学の甲子園
ユーザー yudedakoyudedako
提出日時 2022-01-26 12:56:01
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,327 ms / 4,000 ms
コード長 680 bytes
コンパイル時間 14,207 ms
コンパイル使用メモリ 263,348 KB
実行使用メモリ 63,804 KB
最終ジャッジ日時 2023-08-17 18:43:10
合計ジャッジ時間 48,475 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,123 ms
63,080 KB
testcase_01 AC 1,162 ms
62,792 KB
testcase_02 AC 1,109 ms
63,040 KB
testcase_03 AC 1,111 ms
62,948 KB
testcase_04 AC 1,097 ms
63,280 KB
testcase_05 AC 1,109 ms
63,100 KB
testcase_06 AC 1,116 ms
63,116 KB
testcase_07 AC 1,105 ms
62,968 KB
testcase_08 AC 1,119 ms
63,020 KB
testcase_09 AC 1,203 ms
63,304 KB
testcase_10 AC 1,117 ms
63,076 KB
testcase_11 AC 1,284 ms
63,804 KB
testcase_12 AC 1,304 ms
63,724 KB
testcase_13 AC 1,310 ms
63,616 KB
testcase_14 AC 1,327 ms
63,552 KB
testcase_15 AC 1,270 ms
63,596 KB
testcase_16 AC 1,106 ms
62,948 KB
testcase_17 AC 1,118 ms
63,072 KB
testcase_18 AC 1,134 ms
62,876 KB
testcase_19 AC 1,269 ms
63,488 KB
testcase_20 AC 1,319 ms
63,728 KB
testcase_21 AC 1,304 ms
63,792 KB
testcase_22 AC 1,323 ms
63,708 KB
testcase_23 AC 1,281 ms
63,600 KB
testcase_24 AC 1,094 ms
63,124 KB
testcase_25 AC 1,100 ms
63,164 KB
testcase_26 AC 1,113 ms
63,168 KB
testcase_27 AC 1,294 ms
63,632 KB
testcase_28 AC 1,287 ms
63,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.annotation.tailrec
import scala.io.StdIn.*
import scala.math.max
@main def main =
  val n = readLine().toInt
  val students = Array.fill(n){
    readLine().split(' ').map(_.toLong)
  }
  val maxScore = Array.tabulate(1 << 6) { pattern =>
    val subject = (0 until 6).filter { i => ((pattern >> i) & 1) == 1 }
    students.map { score => subject.map(score).product }.max
  }
  var result = 0L
  for patternN <- 0 until (1 << 12) do
    val pattern = Array.tabulate(4){i =>
      (0 until 6).map{j => if ((patternN >> (2 * j)) & 3) == i then 1 << j else 0}.sum
    }
    val current = pattern.map(maxScore).product
    result = max(result, current)
  println(result)
0