結果

問題 No.1444 !Andd
ユーザー mkawa2mkawa2
提出日時 2023-12-27 21:53:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 535 ms / 2,000 ms
コード長 1,222 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,332 KB
最終ジャッジ日時 2023-12-27 21:53:30
合計ジャッジ時間 7,418 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,476 KB
testcase_01 AC 42 ms
59,476 KB
testcase_02 AC 41 ms
59,476 KB
testcase_03 AC 166 ms
76,052 KB
testcase_04 AC 134 ms
76,052 KB
testcase_05 AC 57 ms
68,700 KB
testcase_06 AC 138 ms
76,048 KB
testcase_07 AC 152 ms
76,048 KB
testcase_08 AC 239 ms
76,180 KB
testcase_09 AC 168 ms
76,052 KB
testcase_10 AC 56 ms
66,612 KB
testcase_11 AC 53 ms
66,640 KB
testcase_12 AC 283 ms
76,304 KB
testcase_13 AC 369 ms
76,536 KB
testcase_14 AC 73 ms
76,120 KB
testcase_15 AC 359 ms
76,544 KB
testcase_16 AC 534 ms
77,200 KB
testcase_17 AC 88 ms
77,040 KB
testcase_18 AC 507 ms
77,328 KB
testcase_19 AC 507 ms
77,200 KB
testcase_20 AC 535 ms
77,328 KB
testcase_21 AC 513 ms
77,328 KB
testcase_22 AC 507 ms
77,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

n=II()
aa=LI()
m=1024

under=set()
under.add(1)
over=[0]*m
zero=0
for a in aa:
    if a==0:zero=1
    if zero:
        print(1)
        continue
    pu,po,under,over=under,over,set(),[0]*m
    for p in pu:
        s=p*a
        if s<m:
            under.add(s)
        else:
            over[s%m]+=1
        under.add(p&a)
    for p in range(m):
        if po[p]:
            over[p*a%m]+=po[p]
            under.add(p&a)
    print(sum(over)+len(under))
0