結果

問題 No.1863 Xor Sum 2...?
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-09 13:55:00
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 846 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 68,144 KB
実行使用メモリ 40,960 KB
最終ジャッジ日時 2023-10-09 13:55:08
合計ジャッジ時間 7,890 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,948 KB
testcase_01 AC 63 ms
19,880 KB
testcase_02 AC 63 ms
21,904 KB
testcase_03 AC 63 ms
21,852 KB
testcase_04 AC 63 ms
21,908 KB
testcase_05 AC 82 ms
23,208 KB
testcase_06 AC 75 ms
20,664 KB
testcase_07 AC 90 ms
24,284 KB
testcase_08 AC 89 ms
24,192 KB
testcase_09 AC 128 ms
39,292 KB
testcase_10 AC 125 ms
36,864 KB
testcase_11 AC 98 ms
25,448 KB
testcase_12 AC 89 ms
24,152 KB
testcase_13 AC 109 ms
28,888 KB
testcase_14 AC 126 ms
38,928 KB
testcase_15 AC 108 ms
28,724 KB
testcase_16 AC 110 ms
29,056 KB
testcase_17 AC 92 ms
26,816 KB
testcase_18 AC 78 ms
23,020 KB
testcase_19 AC 88 ms
24,052 KB
testcase_20 AC 101 ms
28,056 KB
testcase_21 AC 121 ms
36,300 KB
testcase_22 AC 85 ms
26,036 KB
testcase_23 AC 135 ms
39,904 KB
testcase_24 AC 140 ms
38,524 KB
testcase_25 AC 141 ms
40,820 KB
testcase_26 AC 140 ms
38,800 KB
testcase_27 AC 141 ms
40,960 KB
testcase_28 AC 139 ms
38,732 KB
testcase_29 AC 142 ms
38,844 KB
testcase_30 AC 142 ms
38,716 KB
権限があれば一括ダウンロードができます

ソースコード

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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var b = NList;
        var ans = 0;
        for (var i = 0; i < n; ++i)
        {
            var sum = 0L;
            var xa = 0L;
            var xb = 0L;
            for (var j = i; j < n; ++j)
            {
                sum += a[j];
                xa ^= a[j];
                xb ^= b[j];
                if (sum - xa == xb) ++ans;
                if (sum - xa > 1) break;
            }
        }
        WriteLine(ans);
    }
}
0