結果

問題 No.1410 A lot of Bit Operations
ユーザー googol_S0googol_S0
提出日時 2021-02-26 21:55:09
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 1,120 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 71,500 KB
最終ジャッジ日時 2023-07-25 21:04:34
合計ジャッジ時間 6,490 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,012 KB
testcase_01 AC 77 ms
71,316 KB
testcase_02 AC 77 ms
71,312 KB
testcase_03 AC 75 ms
70,968 KB
testcase_04 AC 77 ms
71,252 KB
testcase_05 AC 77 ms
71,228 KB
testcase_06 AC 77 ms
71,216 KB
testcase_07 AC 74 ms
71,224 KB
testcase_08 AC 78 ms
71,212 KB
testcase_09 AC 80 ms
71,060 KB
testcase_10 AC 78 ms
71,500 KB
testcase_11 AC 76 ms
71,280 KB
testcase_12 AC 77 ms
71,176 KB
testcase_13 AC 77 ms
71,256 KB
testcase_14 AC 76 ms
71,204 KB
testcase_15 AC 74 ms
71,308 KB
testcase_16 AC 77 ms
71,188 KB
testcase_17 AC 77 ms
71,372 KB
testcase_18 AC 77 ms
71,404 KB
testcase_19 AC 76 ms
71,368 KB
testcase_20 AC 76 ms
71,232 KB
testcase_21 AC 77 ms
71,056 KB
testcase_22 AC 76 ms
71,064 KB
testcase_23 AC 77 ms
71,172 KB
testcase_24 AC 78 ms
71,492 KB
testcase_25 AC 76 ms
71,172 KB
testcase_26 AC 77 ms
71,256 KB
testcase_27 AC 75 ms
71,312 KB
testcase_28 AC 75 ms
71,448 KB
testcase_29 AC 76 ms
71,244 KB
testcase_30 AC 76 ms
71,388 KB
testcase_31 AC 76 ms
71,224 KB
testcase_32 AC 76 ms
71,472 KB
testcase_33 AC 76 ms
71,252 KB
testcase_34 AC 76 ms
71,200 KB
testcase_35 AC 76 ms
71,332 KB
testcase_36 AC 75 ms
71,300 KB
testcase_37 AC 76 ms
71,324 KB
testcase_38 AC 74 ms
71,344 KB
testcase_39 AC 77 ms
71,252 KB
testcase_40 AC 76 ms
71,448 KB
testcase_41 AC 76 ms
71,352 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 77 ms
71,104 KB
testcase_45 AC 78 ms
71,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
K=input()
if N==1:
  ANS=0
  for i in range(8):
    if K[i]=='-':
      continue
    X=[(i&(1<<j))>>j for j in range(4)]
    for x in range(2):
      for y in range(2):
        for z in range(2):
          if (X[x][y]-z)*((1-X[x][y])-z)<=0:
            ANS+=1
  print(ANS)
  exit()
mod=10**9+7
ANS=0
t=pow(2,2*N,mod)
x=(pow(2,N-1,mod)-1)%mod
for i in range(8):
  if K[i]=='-':
    continue
  X=[(i&(1<<j))>>j for j in range(4)]
  Y=[X.count(0),X.count(1)]
  ANS+=t
  ANS+=x*pow(4,N-2,mod)*(Y[0]*Y[0]+Y[1]*Y[1])%mod
  ANS-=x*pow(4,N-2,mod)*(Y[0]*Y[1]+Y[1]*Y[0])%mod
  ANS+=pow(4,N,mod)*pow(2,N-1,mod)
print(ANS%mod)
0