結果

問題 No.1245 ANDORゲーム(calc)
ユーザー keymoonkeymoon
提出日時 2020-10-02 21:28:19
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,524 bytes
コンパイル時間 3,291 ms
コンパイル使用メモリ 105,140 KB
実行使用メモリ 49,152 KB
最終ジャッジ日時 2023-09-23 04:08:41
合計ジャッジ時間 19,399 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,976 KB
testcase_01 AC 61 ms
21,792 KB
testcase_02 AC 62 ms
23,820 KB
testcase_03 AC 62 ms
21,784 KB
testcase_04 AC 61 ms
22,044 KB
testcase_05 AC 62 ms
23,836 KB
testcase_06 AC 64 ms
21,840 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 576 ms
40,436 KB
testcase_26 AC 581 ms
44,420 KB
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nq = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nq[0];
        var q = nq[1];
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var s = Console.ReadLine();

        var reses = new[] { new long[32], new long[32] };

        for (int type = 0; type <= 1; type++)
        {
            for (int i = 0; i < 32; i++)
            {
                var res = 0;
                var current = type;
                for (int j = 0; j < n; j++)
                {
                    var bit = (a[j] >> i) & 1;
                    var c = s[j];
                    var next = c == '0' ? (current & bit) : (current | bit);
                    res += Abs(next - current);
                    current = next;
                }
                reses[type][i] = res * (1 << i);
            }
        }
        
        var queries = Console.ReadLine().Split().Select(int.Parse).ToArray();

        foreach (var query in queries)
        {
            var res = 0L;
            for (int i = 0; i < 32; i++)
            {
                res += reses[query >> i & 1][i];
            }
            Console.WriteLine(res);
        }
    }
}
0