結果
| 問題 |
No.1633 Sorting Integers (Multiple of 2^K)
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2021-07-07 12:50:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 782 ms / 2,000 ms |
| コード長 | 379 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,416 KB |
| 最終ジャッジ日時 | 2024-09-15 21:45:27 |
| 合計ジャッジ時間 | 10,907 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 45 |
ソースコード
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))
とりゐ