結果

問題 No.1633 Sorting Integers (Multiple of 2^K)
ユーザー とりゐとりゐ
提出日時 2021-07-07 12:50:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 783 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 86,508 KB
実行使用メモリ 77,832 KB
最終ジャッジ日時 2023-10-14 02:02:58
合計ジャッジ時間 12,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,128 KB
testcase_01 AC 73 ms
71,356 KB
testcase_02 AC 73 ms
71,192 KB
testcase_03 AC 75 ms
70,948 KB
testcase_04 AC 73 ms
71,284 KB
testcase_05 AC 74 ms
70,968 KB
testcase_06 AC 74 ms
71,132 KB
testcase_07 AC 74 ms
71,068 KB
testcase_08 AC 73 ms
70,948 KB
testcase_09 AC 73 ms
71,220 KB
testcase_10 AC 73 ms
71,020 KB
testcase_11 AC 72 ms
71,108 KB
testcase_12 AC 73 ms
70,812 KB
testcase_13 AC 74 ms
70,984 KB
testcase_14 AC 74 ms
71,180 KB
testcase_15 AC 73 ms
71,112 KB
testcase_16 AC 74 ms
70,880 KB
testcase_17 AC 73 ms
71,216 KB
testcase_18 AC 73 ms
70,988 KB
testcase_19 AC 74 ms
70,816 KB
testcase_20 AC 72 ms
71,132 KB
testcase_21 AC 73 ms
70,980 KB
testcase_22 AC 72 ms
71,236 KB
testcase_23 AC 693 ms
77,156 KB
testcase_24 AC 743 ms
77,420 KB
testcase_25 AC 740 ms
77,480 KB
testcase_26 AC 744 ms
77,512 KB
testcase_27 AC 697 ms
77,832 KB
testcase_28 AC 604 ms
77,296 KB
testcase_29 AC 783 ms
77,148 KB
testcase_30 AC 637 ms
77,264 KB
testcase_31 AC 649 ms
77,088 KB
testcase_32 AC 496 ms
77,068 KB
testcase_33 AC 113 ms
76,976 KB
testcase_34 AC 94 ms
76,208 KB
testcase_35 AC 127 ms
76,772 KB
testcase_36 AC 109 ms
76,648 KB
testcase_37 AC 137 ms
76,516 KB
testcase_38 AC 333 ms
76,668 KB
testcase_39 AC 120 ms
76,796 KB
testcase_40 AC 92 ms
76,280 KB
testcase_41 AC 263 ms
77,004 KB
testcase_42 AC 98 ms
76,672 KB
testcase_43 AC 114 ms
76,868 KB
testcase_44 AC 326 ms
77,388 KB
testcase_45 AC 180 ms
76,836 KB
testcase_46 AC 100 ms
76,908 KB
testcase_47 AC 73 ms
71,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
def g(n,p):
  if p==N:
    cnt=0
    while n%2==0:
      cnt+=1
      n//=2
    return cnt
  num=p
  c=b.copy()
  for i in str(n):
    c[int(i)-1]-=1
  for k in range(9):
    if c[k]>0 and (n+(k+1)*pow(10,p))%pow(2,p+1)==0:
      num=max(num,g(n+(k+1)*10**p,p+1))
  return num

N=int(input())
b=list(map(int,input().split()))
print(g(0,0))
0