結果
| 問題 |
No.3276 Make Smaller Popcount
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-20 23:02:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,558 ms / 2,000 ms |
| コード長 | 298 bytes |
| コンパイル時間 | 676 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-09-20 23:02:56 |
| 合計ジャッジ時間 | 43,379 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 28 |
ソースコード
t = int(input())
for case_ in range(0,t):
n = int(input())
if bin(n).count("1") == 1:
print(-1)
else:
n2 = n
n = bin(n)[::-1][:-2]
temp = n[n.index("1") + 1:].index("1") + n.index("1") + 1
print((1 << (temp + 1)) - (n2 & ((1 << (temp + 1)) - 1)))