結果
問題 |
No.2672 Subset Xor Sum
|
ユーザー |
|
提出日時 | 2024-03-15 21:39:44 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 716 bytes |
コンパイル時間 | 730 ms |
コンパイル使用メモリ | 82,532 KB |
実行使用メモリ | 407,356 KB |
最終ジャッジ日時 | 2024-09-30 00:34:53 |
合計ジャッジ時間 | 16,121 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | AC * 29 WA * 1 RE * 36 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) input = sys.stdin.readline n = int(input()) a = list(map(int,input().split())) if functools.reduce(operator.xor,a) != 0: print('No') exit() c = collections.Counter(a) for i in a: if c[i] >= 2: print('Yes') exit() dp = [[0 for i in range(8193)] for j in range(n+1)] dp[1][a[0]] = 1 for i in range(n): for j in range(8193): dp[i+1][j] += dp[i][j] dp[i+1][j ^ a[i]] += dp[i][j] dp[i+1][j] = min(dp[i+1][j],2) dp[i+1][j ^ a[i]] = min(dp[i+1][j ^ a[i]],2) print('Yes' if dp[-1][0] >= 2 else 'No')