結果
問題 |
No.1852 Divide or Reduce
|
ユーザー |
|
提出日時 | 2022-03-01 13:20:54 |
言語 | Scala(Beta) (3.6.2) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 838 bytes |
コンパイル時間 | 13,649 ms |
コンパイル使用メモリ | 265,652 KB |
実行使用メモリ | 69,776 KB |
最終ジャッジ日時 | 2025-02-24 17:31:07 |
合計ジャッジ時間 | 23,409 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 1 |
other | -- * 20 |
ソースコード
import java.io.PrintWriter import scala.collection.mutable.* import scala.io.StdIn.* import scala.util.chaining.* import scala.math.* import scala.reflect.ClassTag import scala.util.* import scala.annotation.tailrec import scala.collection.mutable def write[R](func: PrintWriter ?=> R): R = val writer = PrintWriter(System.out) try { func(using writer) }finally { writer.close() } inline def println[T](value: T)(using writer: PrintWriter) = writer.println(value) @main def main = write { val testCase = readLine.toInt for _ <- 0 until testCase do val n = readLine.toInt val pile = readLine.split(' ').map(_.toLong) val min = pile.min val sum = pile.sum val firstWin = (sum - n) % 2 == 1 || (n % 2 == 0 && min % 2 == 0) println { if firstWin then "First" else "Second" } }