結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | crazybbb3 |
提出日時 | 2017-01-17 22:47:33 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 461 ms / 5,000 ms |
コード長 | 2,107 bytes |
コンパイル時間 | 4,095 ms |
コンパイル使用メモリ | 75,324 KB |
実行使用メモリ | 52,496 KB |
最終ジャッジ日時 | 2023-09-12 09:49:11 |
合計ジャッジ時間 | 8,266 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
47,548 KB |
testcase_01 | AC | 49 ms
49,608 KB |
testcase_02 | AC | 52 ms
49,972 KB |
testcase_03 | AC | 52 ms
49,644 KB |
testcase_04 | AC | 47 ms
49,624 KB |
testcase_05 | AC | 52 ms
49,364 KB |
testcase_06 | AC | 50 ms
49,612 KB |
testcase_07 | AC | 461 ms
52,400 KB |
testcase_08 | AC | 363 ms
52,432 KB |
testcase_09 | AC | 266 ms
51,240 KB |
testcase_10 | AC | 299 ms
52,496 KB |
testcase_11 | AC | 389 ms
52,304 KB |
testcase_12 | AC | 57 ms
51,168 KB |
testcase_13 | AC | 44 ms
49,444 KB |
testcase_14 | AC | 261 ms
52,128 KB |
testcase_15 | AC | 394 ms
52,436 KB |
testcase_16 | AC | 50 ms
49,440 KB |
testcase_17 | AC | 144 ms
52,120 KB |
testcase_18 | AC | 411 ms
52,284 KB |
testcase_19 | AC | 104 ms
51,636 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; public class CreateInput { static BufferedReader in; static PrintWriter out; static StringTokenizer tok; void solve() throws IOException { int n = ni(); int[] a = nia(n); boolean[] dp = new boolean[1 << 15]; dp[0] = true; for (int i = 0; i < n; i++) { for (int j = 0; j < 1 << 15; j++) { if (dp[j]) dp[j ^ a[i]] = true; } } int ans = 0; for (int i = 0; i < 1 << 15; i++) { if (dp[i]) ans++; } out.println(ans); } String ns() throws IOException { while (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine(), " "); } return tok.nextToken(); } int ni() throws IOException { return Integer.parseInt(ns()); } long nl() throws IOException { return Long.parseLong(ns()); } double nd() throws IOException { return Double.parseDouble(ns()); } String[] nsa(int n) throws IOException { String[] res = new String[n]; for (int i = 0; i < n; i++) { res[i] = ns(); } return res; } int[] nia(int n) throws IOException { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = ni(); } return res; } long[] nla(int n) throws IOException { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nl(); } return res; } public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = new StringTokenizer(""); CreateInput main = new CreateInput(); main.solve(); out.close(); } }