Submission #62081369


Source Code Expand

Copy
import sys
sys.setrecursionlimit(10**6)
n = int(input())
a = list(map(int, input().split()))
ans = set()
visited = set()
sm = sum(a)
def f(A):
state = tuple(sorted(A))
if state in visited:
return
visited.add(state)
acc = 0
for ai in A:
acc ^= ai
ans.add(acc)
for i in range(n):
for j in range(n):
if i != j and A[j] > 0:
tmp = A[:]
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
import sys
sys.setrecursionlimit(10**6)
n = int(input())
a = list(map(int, input().split()))
ans = set()
visited = set()
sm = sum(a)
def f(A):
    state = tuple(sorted(A))
    if state in visited:
        return
    visited.add(state)
    acc = 0
    for ai in A:
        acc ^= ai
    ans.add(acc)
    
    for i in range(n):
        for j in range(n):
            if i != j and A[j] > 0:
                tmp = A[:]
                tmp[i] += tmp[j]
                tmp[j] = 0
                f(tmp)
f(a)
print(len(ans))

Submission Info

Submission Time
Task D - Stone XOR
User juten
Language Python (PyPy 3.10-v7.3.12)
Score 0
Code Size 545 Byte
Status TLE
Exec Time 3320 ms
Memory 157568 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 23
TLE × 16
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt
Case Name Status Exec Time Memory
example_00.txt AC 63 ms 76444 KB
example_01.txt AC 62 ms 76688 KB
example_02.txt AC 78 ms 81772 KB
hand_00.txt AC 72 ms 82120 KB
hand_01.txt TLE 3317 ms 130524 KB
hand_02.txt TLE 3317 ms 136136 KB
hand_03.txt TLE 3318 ms 145196 KB
hand_04.txt AC 62 ms 76536 KB
hand_05.txt TLE 3317 ms 129932 KB
random_00.txt AC 2308 ms 145508 KB
random_01.txt AC 66 ms 80800 KB
random_02.txt AC 66 ms 80808 KB
random_03.txt AC 121 ms 84464 KB
random_04.txt TLE 3318 ms 155764 KB
random_05.txt TLE 3317 ms 135100 KB
random_06.txt AC 864 ms 98560 KB
random_07.txt AC 63 ms 76440 KB
random_08.txt TLE 3317 ms 131912 KB
random_09.txt AC 849 ms 98180 KB
random_10.txt TLE 3320 ms 136112 KB
random_11.txt AC 2097 ms 127028 KB
random_12.txt AC 2097 ms 127996 KB
random_13.txt TLE 3318 ms 139760 KB
random_14.txt TLE 3318 ms 143104 KB
random_15.txt TLE 3318 ms 157568 KB
random_16.txt TLE 3318 ms 155776 KB
random_17.txt AC 2290 ms 145872 KB
random_18.txt AC 2294 ms 145844 KB
random_19.txt AC 67 ms 80708 KB
random_20.txt AC 75 ms 81728 KB
random_21.txt TLE 3317 ms 141924 KB
random_22.txt AC 2157 ms 130820 KB
random_23.txt AC 60 ms 76616 KB
random_24.txt TLE 3318 ms 148148 KB
random_25.txt AC 666 ms 95328 KB
random_26.txt AC 87 ms 83296 KB
random_27.txt TLE 3317 ms 136480 KB
random_28.txt AC 2258 ms 126476 KB
random_29.txt TLE 3317 ms 135640 KB


2025-05-05 (Mon)
15:10:02 +09:00