結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-17 15:55:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 370 bytes |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 16,768 KB |
| 最終ジャッジ日時 | 2024-07-19 05:24:33 |
| 合計ジャッジ時間 | 6,615 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 29 |
ソースコード
def NX(a):
global N,K
K.append(a)
r=[]
b=bin(a).count("1")
if 0 < a-b and not a-b in K:r.append(a-b)
if N >= a+b and not a+b in K:r.append(a+b)
return(r)
N=int(input())
G=-1 if N!=1 else 1
buf=[[1,1]] if N!=1 else []
K=[]
while len(buf):
c,n=buf.pop(0)
for i in NX(n):
if i==N:
buf.clear()
G=c+1
buf.append([c+1,i])
print(G)