結果
| 問題 |
No.2672 Subset Xor Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-15 21:46:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,448 ms / 2,000 ms |
| コード長 | 727 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 406,972 KB |
| 最終ジャッジ日時 | 2024-09-30 04:18:07 |
| 合計ジャッジ時間 | 20,117 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 66 |
ソースコード
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 and n >= 3:
print('Yes')
exit()
dp = [[0 for i in range(8192)] for j in range(n+1)]
dp[1][a[0]] = 1
for i in range(n):
for j in range(8192):
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')