結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | さかぽん |
提出日時 | 2021-02-06 18:39:33 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 619 ms / 2,000 ms |
コード長 | 2,136 bytes |
コンパイル時間 | 1,014 ms |
コンパイル使用メモリ | 114,688 KB |
実行使用メモリ | 118,716 KB |
最終ジャッジ日時 | 2024-06-12 17:24:50 |
合計ジャッジ時間 | 60,508 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 571 ms
59,912 KB |
testcase_01 | AC | 531 ms
103,140 KB |
testcase_02 | AC | 584 ms
60,036 KB |
testcase_03 | AC | 575 ms
104,412 KB |
testcase_04 | AC | 619 ms
59,744 KB |
testcase_05 | AC | 590 ms
109,088 KB |
testcase_06 | AC | 568 ms
61,176 KB |
testcase_07 | AC | 589 ms
118,716 KB |
testcase_08 | AC | 580 ms
61,644 KB |
testcase_09 | AC | 595 ms
102,568 KB |
testcase_10 | AC | 580 ms
60,952 KB |
testcase_11 | AC | 588 ms
60,852 KB |
testcase_12 | AC | 603 ms
60,024 KB |
testcase_13 | AC | 585 ms
64,920 KB |
testcase_14 | AC | 600 ms
62,188 KB |
testcase_15 | AC | 582 ms
62,896 KB |
testcase_16 | AC | 593 ms
62,280 KB |
testcase_17 | AC | 592 ms
63,632 KB |
testcase_18 | AC | 593 ms
56,972 KB |
testcase_19 | AC | 589 ms
55,944 KB |
testcase_20 | AC | 531 ms
49,012 KB |
testcase_21 | AC | 546 ms
53,108 KB |
testcase_22 | AC | 605 ms
55,100 KB |
testcase_23 | AC | 597 ms
54,952 KB |
testcase_24 | AC | 594 ms
55,068 KB |
testcase_25 | AC | 547 ms
52,544 KB |
testcase_26 | AC | 577 ms
52,676 KB |
testcase_27 | AC | 596 ms
54,708 KB |
testcase_28 | AC | 577 ms
52,532 KB |
testcase_29 | AC | 597 ms
52,500 KB |
testcase_30 | AC | 532 ms
53,112 KB |
testcase_31 | AC | 546 ms
52,296 KB |
testcase_32 | AC | 599 ms
52,404 KB |
testcase_33 | AC | 540 ms
54,568 KB |
testcase_34 | AC | 598 ms
52,656 KB |
testcase_35 | AC | 537 ms
54,444 KB |
testcase_36 | AC | 532 ms
54,576 KB |
testcase_37 | AC | 549 ms
54,584 KB |
testcase_38 | AC | 547 ms
52,788 KB |
testcase_39 | AC | 533 ms
53,232 KB |
testcase_40 | AC | 561 ms
54,316 KB |
testcase_41 | AC | 566 ms
49,580 KB |
testcase_42 | AC | 595 ms
52,528 KB |
testcase_43 | AC | 556 ms
54,700 KB |
testcase_44 | AC | 555 ms
52,396 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 { const long M = 998244353; const long MHalf = (M + 1) / 2; 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 = (long[])c[i].Clone(); c2 = Convolution(c2, c[i]); r -= c2[x..(y + 1)].Sum(); r = MInt(r); } 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 long MInt(long x) => (x %= M) < 0 ? x + M : x; 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); } } } static void Fwt(long[] c, bool inverse = false) { 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]; if (inverse) { c[j] = MInt((x + y) * MHalf); c[j | i] = MInt((x - y) * MHalf); } else { c[j] = MInt(x + y); c[j | i] = MInt(x - y); } } } } public static long[] Convolution(long[] a, long[] b) { Fwt(a); Fwt(b); for (int i = 0; i < a.Length; ++i) a[i] = a[i] * b[i] % M; Fwt(a, true); return a; } }