結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー |
|
提出日時 | 2021-02-06 16:13:07 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,019 bytes |
コンパイル時間 | 1,041 ms |
コンパイル使用メモリ | 114,216 KB |
実行使用メモリ | 29,440 KB |
最終ジャッジ日時 | 2024-06-12 17:23:04 |
合計ジャッジ時間 | 6,165 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 24 WA * 21 RE * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();k = a.Length;var dp = NewArray2<long>(n + 1, 1 << 10);dp[0][0] = 1;foreach (var v in a)dp[1][v] = 1;for (int i = 0; i < k; i++){for (int j = i + 1; j < k; j++){dp[2][a[i] ^ a[j]] += 2;}}for (int i = 2; i < n; i++){for (int j = 0; j < 1 << 10; j++){if (dp[i][j] == 0) continue;foreach (var v in a){var nv = j ^ v;dp[i + 1][nv] += dp[i][j] - dp[i - 1][nv];dp[i + 1][nv] %= M;}}}Console.WriteLine(dp[n][x..(y + 1)].Sum() % M);}static T[][] NewArray2<T>(int n1, int n2, T v = default) => Array.ConvertAll(new bool[n1], _ => Array.ConvertAll(new bool[n2], __ => v));}