結果

問題 No.2672 Subset Xor Sum
ユーザー SoniSoni
提出日時 2024-03-15 23:38:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 1,338 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 152,468 KB
最終ジャッジ日時 2024-03-16 17:43:30
合計ジャッジ時間 6,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,604 KB
testcase_01 AC 42 ms
55,604 KB
testcase_02 AC 40 ms
55,604 KB
testcase_03 AC 41 ms
55,604 KB
testcase_04 AC 40 ms
55,604 KB
testcase_05 AC 40 ms
55,604 KB
testcase_06 AC 40 ms
55,604 KB
testcase_07 AC 40 ms
55,604 KB
testcase_08 AC 40 ms
55,604 KB
testcase_09 AC 40 ms
55,604 KB
testcase_10 AC 40 ms
55,604 KB
testcase_11 AC 40 ms
55,604 KB
testcase_12 AC 41 ms
55,604 KB
testcase_13 AC 39 ms
55,604 KB
testcase_14 AC 40 ms
55,604 KB
testcase_15 AC 39 ms
55,604 KB
testcase_16 AC 40 ms
55,604 KB
testcase_17 AC 42 ms
55,604 KB
testcase_18 AC 39 ms
55,604 KB
testcase_19 AC 40 ms
55,604 KB
testcase_20 AC 40 ms
55,604 KB
testcase_21 AC 40 ms
55,604 KB
testcase_22 AC 39 ms
55,604 KB
testcase_23 AC 39 ms
55,604 KB
testcase_24 AC 41 ms
55,604 KB
testcase_25 AC 39 ms
55,604 KB
testcase_26 AC 43 ms
61,584 KB
testcase_27 AC 43 ms
61,584 KB
testcase_28 AC 39 ms
55,604 KB
testcase_29 AC 40 ms
55,604 KB
testcase_30 AC 39 ms
55,604 KB
testcase_31 AC 208 ms
140,944 KB
testcase_32 AC 112 ms
101,616 KB
testcase_33 AC 102 ms
98,264 KB
testcase_34 AC 165 ms
111,816 KB
testcase_35 AC 205 ms
140,476 KB
testcase_36 AC 181 ms
121,836 KB
testcase_37 AC 198 ms
130,552 KB
testcase_38 AC 120 ms
105,404 KB
testcase_39 AC 222 ms
152,468 KB
testcase_40 AC 74 ms
83,776 KB
testcase_41 AC 105 ms
107,024 KB
testcase_42 AC 124 ms
127,800 KB
testcase_43 AC 112 ms
111,788 KB
testcase_44 AC 138 ms
144,508 KB
testcase_45 AC 113 ms
110,208 KB
testcase_46 AC 44 ms
62,028 KB
testcase_47 AC 50 ms
66,364 KB
testcase_48 AC 45 ms
62,028 KB
testcase_49 AC 44 ms
62,028 KB
testcase_50 AC 44 ms
62,028 KB
testcase_51 AC 48 ms
64,156 KB
testcase_52 AC 49 ms
64,160 KB
testcase_53 AC 51 ms
66,368 KB
testcase_54 AC 49 ms
64,156 KB
testcase_55 AC 50 ms
64,160 KB
testcase_56 AC 44 ms
62,028 KB
testcase_57 AC 48 ms
64,300 KB
testcase_58 AC 48 ms
64,304 KB
testcase_59 AC 40 ms
55,604 KB
testcase_60 AC 44 ms
62,044 KB
testcase_61 AC 44 ms
62,084 KB
testcase_62 AC 48 ms
64,300 KB
testcase_63 AC 48 ms
64,172 KB
testcase_64 AC 51 ms
66,364 KB
testcase_65 AC 49 ms
64,304 KB
testcase_66 AC 40 ms
55,604 KB
testcase_67 AC 40 ms
55,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# import bisect #二分探索
# import math

from collections import deque
from collections import defaultdict


def I():
    return int(sys.stdin.readline().rstrip())


def MI():
    return map(int, sys.stdin.readline().rstrip().split())


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def LI2():
    return list(map(int, sys.stdin.readline().rstrip()))


def S():
    return sys.stdin.readline().rstrip()


def LS():
    return list(sys.stdin.readline().rstrip().split())


def LS2():
    return list(sys.stdin.readline().rstrip())

# 1次元の配列
# list(map(int, input().split()))
# 2次元の配列
# [list(map(int, input().split())) for i in range()]
# wsl pypy3 ファイル名

input = sys.stdin.readline
from collections import Counter, defaultdict

def XOR_Basis(lst):
    xor_basis=[]
    triangulation=[]
    for x in lst:
        xx=x
        for xb in triangulation:
            xx=min(xx,xx^xb)
        if xx:
            xor_basis.append(x)
            triangulation.append(xx)
    return xor_basis,triangulation

N = I()
A = LI()

total_xor = 0
for a in A:
    total_xor ^= a

if total_xor != 0:
    print("No")
    exit()

_,tria=XOR_Basis(A)

K=0
for x in tria:
    if K^x<K:
        K^=x

ans=pow(2,N-len(tria),10**9+7)

if ans == 2:
    print("No")
else:
    print("Yes")
0