結果

問題 No.1304 あなたは基本が何か知っていますか?私は知っています.
ユーザー さかぽんさかぽん
提出日時 2020-12-27 19:38:14
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,465 bytes
コンパイル時間 4,023 ms
コンパイル使用メモリ 109,948 KB
実行使用メモリ 38,156 KB
最終ジャッジ日時 2023-09-03 04:11:14
合計ジャッジ時間 7,149 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
38,156 KB
testcase_01 AC 177 ms
31,744 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
04_evil_A_01 -- -
04_evil_A_02 -- -
04_evil_A_03 -- -
04_evil_A_04 -- -
04_evil_A_05 -- -
04_evil_A_06 -- -
04_evil_A_07 -- -
04_evil_A_08 -- -
04_evil_A_09 -- -
04_evil_A_10 -- -
05_evil_B_01 -- -
05_evil_B_02 -- -
05_evil_B_03 -- -
05_evil_B_04 -- -
05_evil_B_05 -- -
05_evil_B_06 -- -
05_evil_B_07 -- -
05_evil_B_08 -- -
05_evil_B_09 -- -
05_evil_B_10 -- -
06_evil_C_01 -- -
06_evil_C_02 -- -
06_evil_C_03 -- -
06_evil_C_04 -- -
06_evil_C_05 -- -
06_evil_C_06 -- -
06_evil_C_07 -- -
06_evil_C_08 -- -
06_evil_C_09 -- -
06_evil_C_10 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

class A
{
	const long M = 998244353;
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int, int, int) Read4() { var a = Read(); return (a[0], a[1], a[2], a[3]); }
	static void Main()
	{
		var (n, k, x, y) = Read4();
		var a = Read();

		a = a.Distinct().ToArray();
		Array.Sort(a);
		k = a.Length;

		var c = NewArray2<long>(1 << 10, 1 << 10);
		var countsByXor = new long[1 << 10];
		var rn1 = Enumerable.Range(0, n / 2 - 1).ToArray();

		Power(a, n / 2, p =>
		{
			if (rn1.Any(i => p[i] == p[i + 1])) return;
			var xor = p.Aggregate((x, y) => x ^ y);
			c[p[0]][xor]++;
			countsByXor[xor]++;
		});

		var r = 0L;
		for (int i = 0; i < 1 << 10; i++)
			for (int j = 0; j < 1 << 10; j++)
			{
				if ((i ^ j) < x || y < (i ^ j)) continue;

				r += countsByXor[i] * countsByXor[j];
				r %= M;

				for (int a0 = 0; a0 < 1 << 10; a0++)
				{
					r -= c[a0][i] * c[a0][j];
					r = (r + M) % M;
				}
			}
		Console.WriteLine(r);
	}

	static T[][] NewArray2<T>(int n1, int n2, T v = default) => Array.ConvertAll(new bool[n1], _ => Array.ConvertAll(new bool[n2], __ => v));

	static void Power<T>(T[] values, int r, Action<T[]> action)
	{
		var n = values.Length;
		var p = new T[r];

		if (r > 0) Dfs(0);
		else action(p);

		void Dfs(int i)
		{
			var i2 = i + 1;
			for (int j = 0; j < n; ++j)
			{
				p[i] = values[j];

				if (i2 < r) Dfs(i2);
				else action(p);
			}
		}
	}
}
0