結果
| 問題 | No.822 Bitwise AND |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 20:46:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 467 bytes |
| 記録 | |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 95,984 KB |
| 実行使用メモリ | 83,712 KB |
| 最終ジャッジ日時 | 2026-07-12 01:22:34 |
| 合計ジャッジ時間 | 2,618 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 3 |
ソースコード
N, K = map(int, input().split())
if N == 0:
if K == 0:
print(1)
else:
print("INF")
else:
count = 0
max_x = N + 2 * K # Covering x up to N + 2K to handle all possible y = x + K
for x in range(N, max_x + 1):
if (x & N) != N:
continue # x must have all bits of N set
max_y = min(x + K, max_x)
for y in range(x, max_y + 1):
if (x & y) == N:
count += 1
print(count)
gew1fw