結果
問題 |
No.2672 Subset Xor Sum
|
ユーザー |
|
提出日時 | 2024-03-15 21:32:50 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 721 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 726,908 KB |
最終ジャッジ日時 | 2024-09-30 00:28:03 |
合計ジャッジ時間 | 28,263 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 60 WA * 1 TLE * 4 MLE * 1 |
ソースコード
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(1<<13+1)] for j in range(n+1)] dp[1][a[0]] = 1 for i in range(n): for j in range(1<<13+1): 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')