結果

問題 No.1465 Archaea
ユーザー rlangevinrlangevin
提出日時 2023-02-05 02:06:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 71,420 KB
最終ジャッジ日時 2023-09-16 21:21:17
合計ジャッジ時間 3,225 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,156 KB
testcase_01 AC 65 ms
71,148 KB
testcase_02 AC 66 ms
71,300 KB
testcase_03 AC 66 ms
71,252 KB
testcase_04 AC 66 ms
71,048 KB
testcase_05 AC 67 ms
71,256 KB
testcase_06 AC 67 ms
71,372 KB
testcase_07 AC 69 ms
71,336 KB
testcase_08 AC 69 ms
70,900 KB
testcase_09 AC 67 ms
71,148 KB
testcase_10 AC 67 ms
71,408 KB
testcase_11 AC 66 ms
71,364 KB
testcase_12 AC 65 ms
71,300 KB
testcase_13 AC 68 ms
71,352 KB
testcase_14 AC 67 ms
71,028 KB
testcase_15 AC 65 ms
71,184 KB
testcase_16 AC 67 ms
71,420 KB
testcase_17 AC 66 ms
70,900 KB
testcase_18 AC 64 ms
71,084 KB
testcase_19 AC 65 ms
71,148 KB
testcase_20 AC 67 ms
70,900 KB
testcase_21 AC 65 ms
71,180 KB
testcase_22 AC 63 ms
71,312 KB
testcase_23 AC 62 ms
71,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def popcount(n):
    cnt = 0
    while n:
        cnt += n & 1
        n //= 2
    return cnt

N, K = map(int, input().split())
two = 1
for i in range(20):
    M = N - two
    cnt = i
    
    if M % 3 != 0 or M < 0:
        two *= 2
        continue
    q, r = divmod(M//3, two)
    cnt += q + popcount(r)
    # print(i, M, q, r, cnt)
    if cnt <= K:
        print("YES")
        exit()
    two *= 2    
print("NO")
0