結果

問題 No.1958 Bit Game
ユーザー 👑 kakel-sankakel-san
提出日時 2022-05-27 23:07:17
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,417 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 110,000 KB
実行使用メモリ 74,032 KB
最終ジャッジ日時 2023-10-20 20:38:18
合計ジャッジ時間 22,597 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 302 ms
60,632 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 616 ms
68,484 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 787 ms
64,268 KB
testcase_21 WA -
testcase_22 AC 474 ms
62,000 KB
testcase_23 AC 223 ms
57,528 KB
testcase_24 WA -
testcase_25 AC 312 ms
57,544 KB
testcase_26 AC 698 ms
69,252 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 443 ms
63,876 KB
testcase_30 AC 29 ms
25,292 KB
testcase_31 AC 29 ms
25,292 KB
testcase_32 AC 30 ms
25,292 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 long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static void Main()
    {
        var c = NList;
        var (n, x, y) = (c[0], c[1], c[2]);
        var a = NList;
        var b = NList;
        WriteLine(Xor((int)n, x, y, a, b));
    }
    static long Xor(int n, long x, long y, long[] a, long[] b)
    {
        var res = 0L;
        var mod = 998_244_353L;
        for (var i = 0; i < 18; ++i)
        {
            long a1 = 0L;
            long b1 = 0L;
            foreach (var ai in a) a1 += (ai >> i) % 2;
            foreach (var bi in b) b1 += (bi >> i) % 2;
            long x_x = (long)x * y - a1 * b1;
            long x_o = a1 * b1;
            long o_x = x * (y - b1);
            long o_o = x * b1;
            var dp = new long[n + 1][];
            for (var j = 0; j < dp.Length; ++j) dp[j] = new long[2];
            dp[0][0] = 1;
            for (var j = 0; j + 1 < dp.Length; ++j)
            {
                dp[j + 1][0] = (dp[j][0] * x_x % mod + dp[j][1] * o_x % mod) % mod;
                dp[j + 1][1] = (dp[j][0] * x_o % mod + dp[j][1] * o_o % mod) % mod;
            }
            res = (res + (dp[n][1] << i)) % mod;
        }
        return (res);
    }
}
0