結果

問題 No.1852 Divide or Reduce
ユーザー MitarushiMitarushi
提出日時 2022-01-04 22:09:29
言語 Nim
(2.0.2)
結果
AC  
実行時間 510 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 4,676 ms
コンパイル使用メモリ 68,584 KB
実行使用メモリ 27,812 KB
最終ジャッジ日時 2023-09-11 16:04:17
合計ジャッジ時間 11,296 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 152 ms
4,380 KB
testcase_02 AC 153 ms
4,376 KB
testcase_03 AC 151 ms
4,376 KB
testcase_04 AC 154 ms
4,380 KB
testcase_05 AC 152 ms
4,380 KB
testcase_06 AC 120 ms
20,100 KB
testcase_07 AC 124 ms
23,620 KB
testcase_08 AC 122 ms
23,568 KB
testcase_09 AC 120 ms
19,008 KB
testcase_10 AC 124 ms
23,520 KB
testcase_11 AC 136 ms
27,812 KB
testcase_12 AC 133 ms
27,764 KB
testcase_13 AC 133 ms
27,720 KB
testcase_14 AC 134 ms
27,692 KB
testcase_15 AC 136 ms
27,756 KB
testcase_16 AC 510 ms
22,216 KB
testcase_17 AC 504 ms
22,076 KB
testcase_18 AC 508 ms
22,504 KB
testcase_19 AC 457 ms
21,044 KB
testcase_20 AC 506 ms
22,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils

proc solve() =
    let n = stdin.readLine.parseInt
    let a = stdin.readLine.split.map parseInt
    let a_sum = a.foldl(a + b)

    if a.contains(1):
        if (a_sum - n) mod 2 == 0:
            echo "Second"
        else:
            echo "First"
    else:
        if (a_sum - (n + 1)) mod 2 == 0:
            echo "First"
        else:
            if n mod 2 == 1:
                echo "Second"
            else:
                let a_min = a.min
                if a_min mod 2 == 0:
                    echo "First"
                else:
                    echo "Second"


let t = stdin.readLine.parseInt
for _ in 0..<t:
    solve()

0