結果
問題 |
No.1245 ANDORゲーム(calc)
|
ユーザー |
![]() |
提出日時 | 2020-10-02 21:28:19 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,524 bytes |
コンパイル時間 | 1,166 ms |
コンパイル使用メモリ | 110,720 KB |
実行使用メモリ | 53,052 KB |
最終ジャッジ日時 | 2024-07-16 04:17:45 |
合計ジャッジ時間 | 15,027 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); } } }