結果

問題 No.1674 Introduction to XOR
ユーザー bluemeganebluemegane
提出日時 2021-09-10 22:41:19
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 2,242 ms
コンパイル使用メモリ 63,268 KB
実行使用メモリ 22,888 KB
最終ジャッジ日時 2023-09-02 19:36:23
合計ジャッジ時間 4,828 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
18,684 KB
testcase_01 AC 60 ms
22,736 KB
testcase_02 AC 59 ms
22,608 KB
testcase_03 AC 59 ms
20,780 KB
testcase_04 AC 59 ms
20,676 KB
testcase_05 AC 60 ms
22,676 KB
testcase_06 AC 59 ms
22,688 KB
testcase_07 AC 59 ms
22,672 KB
testcase_08 AC 59 ms
20,724 KB
testcase_09 AC 59 ms
20,764 KB
testcase_10 AC 59 ms
22,688 KB
testcase_11 AC 59 ms
20,576 KB
testcase_12 AC 59 ms
20,628 KB
testcase_13 AC 60 ms
20,704 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 60 ms
22,792 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        getAns(n, a);
    }
    static void getAns(int n, long[] a)
    {
        long x;
        if (n == 1) x = a[0];
        else
        {
            x = a[0] | a[1];
            for (int i = 2; i < n; i++) x |= a[i];
        }
        var onf = new bool[60];
        for (int i = 0; i < 60; i++)
        {
            if (((x >> i) & 1) == 1) onf[i] = true;
        }
        var ans = -1L;
        for (int i = 0; i < 60; i++)
        {
            if (!onf[i]) { ans = 1L << i; break; }
        }
        if (ans == -1) ans = 1 << 60;
        Console.WriteLine(ans);
    }
}
0