結果

問題 No.1443 Andd
ユーザー mkawa2mkawa2
提出日時 2022-11-02 12:34:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,712 ms / 2,000 ms
コード長 1,117 bytes
コンパイル時間 2,593 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 88,072 KB
最終ジャッジ日時 2023-09-23 19:24:07
合計ジャッジ時間 15,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
70,992 KB
testcase_01 AC 65 ms
70,616 KB
testcase_02 AC 67 ms
71,128 KB
testcase_03 AC 133 ms
76,788 KB
testcase_04 AC 143 ms
77,420 KB
testcase_05 AC 125 ms
77,360 KB
testcase_06 AC 117 ms
76,576 KB
testcase_07 AC 141 ms
77,024 KB
testcase_08 AC 137 ms
77,268 KB
testcase_09 AC 78 ms
75,740 KB
testcase_10 AC 159 ms
77,336 KB
testcase_11 AC 149 ms
77,416 KB
testcase_12 AC 144 ms
77,280 KB
testcase_13 AC 489 ms
79,884 KB
testcase_14 AC 478 ms
79,892 KB
testcase_15 AC 481 ms
79,736 KB
testcase_16 AC 476 ms
79,780 KB
testcase_17 AC 477 ms
79,740 KB
testcase_18 AC 1,691 ms
87,832 KB
testcase_19 AC 1,711 ms
87,828 KB
testcase_20 AC 1,707 ms
88,040 KB
testcase_21 AC 1,712 ms
87,920 KB
testcase_22 AC 1,695 ms
88,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(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 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

n = II()
aa = LI()

mask = (1 << 10)-1
now = [0]
ans = 1
cs = 0
pre = True
for i, a in enumerate(aa):
    nxt = set()
    cur = set()
    cs += a
    for s in now:
        t = s & a
        cur.add(t-cs)
        nxt.add(t)
        nxt.add((s+a) & mask)
    ans += len(cur)
    if pre and a-cs in cur: ans -= 1
    now = nxt
    pre = -cs in cur
    print(ans)
    # pDB(a, cs, len(now), ans)
0