結果
問題 |
No.1465 Archaea
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:15:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 82,348 KB |
実行使用メモリ | 54,076 KB |
最終ジャッジ日時 | 2025-03-20 21:16:37 |
合計ジャッジ時間 | 1,775 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 3 |
ソースコード
N, K = map(int, input().split()) # Special case: N=1 can be achieved with 0 operations (if K >=0) if N == 1: print("YES") else: possible = False for m in range(0, 60): # 2^60 is way larger than 2e5 x = 1 << m if x > N: break rem = N - x if rem < 0: continue if rem % 3 != 0: continue Q = rem // 3 set_bits = bin(Q).count('1') max_a = min(Q, K - m) if max_a < 0: continue min_a = set_bits if min_a <= max_a: possible = True break print("YES" if possible else "NO")