結果

問題 No.2044 Infinite Nim
ユーザー 👑 kakel-sankakel-san
提出日時 2022-08-19 22:19:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 854 bytes
コンパイル時間 2,749 ms
コンパイル使用メモリ 112,612 KB
実行使用メモリ 33,920 KB
最終ジャッジ日時 2024-04-17 12:04:33
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
19,072 KB
testcase_01 AC 27 ms
19,200 KB
testcase_02 AC 27 ms
19,072 KB
testcase_03 AC 26 ms
19,072 KB
testcase_04 AC 26 ms
18,944 KB
testcase_05 AC 26 ms
19,328 KB
testcase_06 AC 25 ms
18,944 KB
testcase_07 AC 26 ms
18,944 KB
testcase_08 AC 27 ms
19,328 KB
testcase_09 AC 27 ms
19,072 KB
testcase_10 AC 26 ms
18,944 KB
testcase_11 AC 27 ms
19,072 KB
testcase_12 AC 27 ms
19,072 KB
testcase_13 AC 53 ms
23,476 KB
testcase_14 AC 44 ms
22,016 KB
testcase_15 AC 42 ms
21,464 KB
testcase_16 AC 42 ms
22,272 KB
testcase_17 AC 58 ms
24,448 KB
testcase_18 AC 41 ms
21,632 KB
testcase_19 AC 41 ms
21,524 KB
testcase_20 AC 50 ms
23,244 KB
testcase_21 AC 61 ms
25,856 KB
testcase_22 AC 49 ms
23,228 KB
testcase_23 AC 43 ms
22,656 KB
testcase_24 AC 57 ms
24,320 KB
testcase_25 AC 48 ms
22,880 KB
testcase_26 AC 55 ms
24,192 KB
testcase_27 AC 40 ms
22,112 KB
testcase_28 AC 63 ms
26,240 KB
testcase_29 AC 50 ms
24,064 KB
testcase_30 AC 57 ms
24,596 KB
testcase_31 AC 70 ms
27,520 KB
testcase_32 AC 70 ms
27,648 KB
testcase_33 AC 70 ms
27,392 KB
testcase_34 AC 56 ms
25,032 KB
testcase_35 AC 81 ms
33,920 KB
testcase_36 AC 28 ms
19,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        var n = NN;
        var a = NList;
        var infcnt = 0;
        foreach (var ai in a) if (ai == -1) ++infcnt;
        if (infcnt > 0)
        {
            var xor = infcnt == n ? 0 : a.Where(ai => ai >= 0).Aggregate((l, r) => l ^ r);
            WriteLine((xor == 0 && infcnt % 2 == 0) ? "Second" : "First");
        }
        else
        {
            var xor = a.Aggregate((l, r) => l ^ r);
            WriteLine(xor == 0 ? "Second" : "First");
        }
    }
}
0