結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | k3079k |
提出日時 | 2019-09-15 14:52:04 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 960 bytes |
コンパイル時間 | 1,392 ms |
コンパイル使用メモリ | 62,816 KB |
実行使用メモリ | 180,472 KB |
最終ジャッジ日時 | 2023-09-21 04:08:01 |
合計ジャッジ時間 | 17,079 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
14,596 KB |
testcase_01 | AC | 57 ms
14,684 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 61 ms
22,656 KB |
testcase_13 | AC | 57 ms
18,740 KB |
testcase_14 | AC | 1,791 ms
178,288 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace Test01 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] input = Console.ReadLine().Split(' '); int[] a = new int[N + 1]; for (int i = 1; i <= N; i++) a[i] = int.Parse(input[i - 1]); int max = 32767; bool[,] dp = new bool[N + 1, max + 1]; dp[0, 0] = true; for(int i = 1; i <= N; i++) { for(int j = max; j >= 0; j--) { dp[i, j] = dp[i - 1, j]; if ((j ^ a[i]) <= max) dp[i, (j ^ a[i])] |= dp[i, j]; } } int cnt = 0; for(int i = 0; i <= max; i++) { if (dp[N, i]) cnt++; } Console.WriteLine(cnt); } } }