結果

問題 No.1444 !Andd
ユーザー googol_S0googol_S0
提出日時 2021-03-26 21:48:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 983 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 400,072 KB
最終ジャッジ日時 2023-08-19 07:58:50
合計ジャッジ時間 13,090 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,568 KB
testcase_01 AC 68 ms
75,720 KB
testcase_02 AC 69 ms
75,796 KB
testcase_03 AC 251 ms
149,876 KB
testcase_04 AC 181 ms
113,580 KB
testcase_05 AC 300 ms
221,420 KB
testcase_06 AC 206 ms
130,704 KB
testcase_07 AC 176 ms
113,684 KB
testcase_08 AC 370 ms
204,432 KB
testcase_09 AC 257 ms
152,444 KB
testcase_10 AC 234 ms
171,588 KB
testcase_11 AC 252 ms
181,856 KB
testcase_12 AC 439 ms
235,888 KB
testcase_13 AC 665 ms
299,776 KB
testcase_14 AC 673 ms
249,992 KB
testcase_15 AC 589 ms
291,184 KB
testcase_16 AC 983 ms
397,484 KB
testcase_17 AC 746 ms
399,764 KB
testcase_18 AC 812 ms
399,700 KB
testcase_19 AC 807 ms
400,072 KB
testcase_20 AC 811 ms
399,812 KB
testcase_21 AC 812 ms
399,916 KB
testcase_22 AC 821 ms
399,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
DP=[[0]*2048 for j in range(N+1)]
DP[0][1]=1
for i in range(N):
  for j in range(2048):
    if DP[i][j]==0:
      continue
    x=j*A[i]
    if x>=2048:
      x&=1023
      x+=1024
    if x>=1024:
      DP[i+1][x]+=DP[i][j]
    else:
      DP[i+1][x]=1
    DP[i+1][j&A[i]]=1
  print(sum(DP[i+1]))
0