結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | さかぽん |
提出日時 | 2021-02-07 00:12:35 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 623 ms / 2,000 ms |
コード長 | 2,524 bytes |
コンパイル時間 | 1,167 ms |
コンパイル使用メモリ | 115,620 KB |
実行使用メモリ | 132,068 KB |
最終ジャッジ日時 | 2024-06-12 17:28:11 |
合計ジャッジ時間 | 60,314 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 544 ms
70,776 KB |
testcase_01 | AC | 581 ms
117,464 KB |
testcase_02 | AC | 554 ms
70,772 KB |
testcase_03 | AC | 623 ms
119,924 KB |
testcase_04 | AC | 593 ms
73,332 KB |
testcase_05 | AC | 554 ms
121,580 KB |
testcase_06 | AC | 614 ms
72,700 KB |
testcase_07 | AC | 561 ms
132,068 KB |
testcase_08 | AC | 558 ms
72,912 KB |
testcase_09 | AC | 563 ms
119,628 KB |
testcase_10 | AC | 552 ms
69,476 KB |
testcase_11 | AC | 544 ms
119,424 KB |
testcase_12 | AC | 577 ms
75,508 KB |
testcase_13 | AC | 563 ms
117,568 KB |
testcase_14 | AC | 557 ms
73,448 KB |
testcase_15 | AC | 551 ms
116,532 KB |
testcase_16 | AC | 563 ms
73,568 KB |
testcase_17 | AC | 575 ms
122,580 KB |
testcase_18 | AC | 565 ms
73,460 KB |
testcase_19 | AC | 558 ms
66,368 KB |
testcase_20 | AC | 571 ms
65,884 KB |
testcase_21 | AC | 592 ms
66,332 KB |
testcase_22 | AC | 568 ms
66,500 KB |
testcase_23 | AC | 569 ms
68,292 KB |
testcase_24 | AC | 558 ms
68,696 KB |
testcase_25 | AC | 598 ms
67,768 KB |
testcase_26 | AC | 557 ms
66,012 KB |
testcase_27 | AC | 561 ms
65,980 KB |
testcase_28 | AC | 543 ms
65,840 KB |
testcase_29 | AC | 559 ms
67,800 KB |
testcase_30 | AC | 581 ms
63,708 KB |
testcase_31 | AC | 598 ms
65,628 KB |
testcase_32 | AC | 568 ms
65,852 KB |
testcase_33 | AC | 591 ms
65,720 KB |
testcase_34 | AC | 577 ms
67,776 KB |
testcase_35 | AC | 587 ms
63,928 KB |
testcase_36 | AC | 592 ms
65,980 KB |
testcase_37 | AC | 604 ms
67,764 KB |
testcase_38 | AC | 592 ms
67,564 KB |
testcase_39 | AC | 585 ms
67,796 KB |
testcase_40 | AC | 609 ms
69,812 KB |
testcase_41 | AC | 607 ms
61,724 KB |
testcase_42 | AC | 574 ms
65,728 KB |
testcase_43 | AC | 609 ms
65,864 KB |
testcase_44 | AC | 612 ms
63,672 KB |
04_evil_A_01 | RE | - |
04_evil_A_02 | RE | - |
04_evil_A_03 | RE | - |
04_evil_A_04 | RE | - |
04_evil_A_05 | RE | - |
04_evil_A_06 | RE | - |
04_evil_A_07 | RE | - |
04_evil_A_08 | RE | - |
04_evil_A_09 | RE | - |
04_evil_A_10 | RE | - |
05_evil_B_01 | TLE | - |
05_evil_B_02 | TLE | - |
05_evil_B_03 | TLE | - |
05_evil_B_04 | TLE | - |
05_evil_B_05 | TLE | - |
05_evil_B_06 | TLE | - |
05_evil_B_07 | TLE | - |
05_evil_B_08 | TLE | - |
05_evil_B_09 | TLE | - |
05_evil_B_10 | TLE | - |
06_evil_C_01 | RE | - |
06_evil_C_02 | RE | - |
06_evil_C_03 | RE | - |
06_evil_C_04 | RE | - |
06_evil_C_05 | RE | - |
06_evil_C_06 | RE | - |
06_evil_C_07 | RE | - |
06_evil_C_08 | RE | - |
06_evil_C_09 | RE | - |
06_evil_C_10 | RE | - |
コンパイルメッセージ
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 { 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 c = NewArray2<long>(1 << 10, 1 << 10); var xors = 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]++; xors[xor]++; }); var r = 0L; for (int u = 0; u < 1 << 10; u++) for (int v = 0; v < 1 << 10; v++) { if ((u ^ v) < x || y < (u ^ v)) continue; r += xors[u] * xors[v]; r %= M; } for (int i = 0; i < 1 << 10; i++) { var c2 = Hadamard.Convolution(c[i], c[i]); r -= c2[x..(y + 1)].Sum(); r = MInt(r); } Console.WriteLine(r); } const long M = 998244353; static long MInt(long x) => (x %= M) < 0 ? x + M : x; 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); } } } } public static class Hadamard { const long M = 998244353; static long MInt(long x) => (x %= M) < 0 ? x + M : x; static long MPow(long b, long i) { long r = 1; for (; i != 0; b = b * b % M, i >>= 1) if ((i & 1) != 0) r = r * b % M; return r; } static long MInv(long x) => MPow(x, M - 2); static void FwtInternal(long[] c) { var n = c.Length; for (int i = 1; i < n; i <<= 1) for (int j = 0; j < n; j++) { if ((j & i) != 0) continue; var x = c[j]; var y = c[j | i]; c[j] = MInt(x + y); c[j | i] = MInt(x - y); } } // n: Power of 2 // XOR public static long[] Fwt(long[] c, bool inverse = false) { var n = c.Length; var nInv = MInv(n); var r = new long[n]; c.CopyTo(r, 0); FwtInternal(r); if (inverse) for (int i = 0; i < n; ++i) r[i] = r[i] * nInv % M; return r; } public static long[] Convolution(long[] a, long[] b) { var fa = Fwt(a); var fb = Fwt(b); for (int i = 0; i < a.Length; ++i) fa[i] = fa[i] * fb[i] % M; return Fwt(fa, true); } }