QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#770529 | #9541. Expanding Array | JEdward | TL | 22ms | 10720kb | Python3 | 614b | 2024-11-21 22:13:43 | 2024-11-21 22:13:43 |
Judging History
answer
def main():
import sys
sys.setrecursionlimit(1 << 25)
n, *rest = map(int, sys.stdin.read().split())
a = rest[:n]
from collections import deque
existing = set(a)
queue = deque(a)
seen = set(a)
while queue:
u = queue.popleft()
for v in a:
if u != v:
candidates = [u & v, u | v, u ^ v]
for c in candidates:
if c not in seen:
seen.add(c)
queue.append(c)
print(len(seen))
if __name__ == "__main__":
main()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 10592kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 22ms
memory: 10720kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 20ms
memory: 10652kb
input:
2 3 5
output:
8
result:
ok single line: '8'
Test #4:
score: -100
Time Limit Exceeded
input:
10 37760128 12721860 37519778 33518004 2760086 4473592 65451644 83416788 44877547 36766460