結果

問題 No.1792 科学の甲子園
ユーザー yudedakoyudedako
提出日時 2022-01-26 12:56:01
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,215 ms / 4,000 ms
コード長 680 bytes
コンパイル時間 13,903 ms
コンパイル使用メモリ 256,288 KB
実行使用メモリ 66,480 KB
最終ジャッジ日時 2024-05-05 01:33:37
合計ジャッジ時間 44,928 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,015 ms
64,156 KB
testcase_01 AC 976 ms
64,156 KB
testcase_02 AC 987 ms
63,924 KB
testcase_03 AC 1,013 ms
64,092 KB
testcase_04 AC 1,000 ms
63,996 KB
testcase_05 AC 1,003 ms
64,288 KB
testcase_06 AC 983 ms
64,160 KB
testcase_07 AC 998 ms
64,008 KB
testcase_08 AC 1,031 ms
64,148 KB
testcase_09 AC 1,113 ms
65,684 KB
testcase_10 AC 1,033 ms
64,160 KB
testcase_11 AC 1,184 ms
66,272 KB
testcase_12 AC 1,163 ms
66,096 KB
testcase_13 AC 1,193 ms
66,372 KB
testcase_14 AC 1,201 ms
66,220 KB
testcase_15 AC 1,167 ms
66,116 KB
testcase_16 AC 978 ms
63,988 KB
testcase_17 AC 1,001 ms
64,116 KB
testcase_18 AC 982 ms
64,136 KB
testcase_19 AC 1,156 ms
65,960 KB
testcase_20 AC 1,175 ms
66,480 KB
testcase_21 AC 1,215 ms
66,084 KB
testcase_22 AC 1,173 ms
66,340 KB
testcase_23 AC 1,168 ms
66,144 KB
testcase_24 AC 1,007 ms
63,744 KB
testcase_25 AC 1,006 ms
63,900 KB
testcase_26 AC 1,012 ms
63,772 KB
testcase_27 AC 1,207 ms
66,100 KB
testcase_28 AC 1,170 ms
66,296 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