結果
問題 |
No.3276 Make Smaller Popcount
|
ユーザー |
![]() |
提出日時 | 2025-09-16 18:07:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 514 bytes |
コンパイル時間 | 1,578 ms |
コンパイル使用メモリ | 194,884 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-17 18:40:24 |
合計ジャッジ時間 | 5,755 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 RE * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long int T; signed main(){ cin>>T; assert(1 <= T && T <= 2e5); for(int i = 0; i < T; i++){ int N; cin>>N; assert(1 <= N && N <= 1ll<<30 - 1); int mi = -1; int mi2 = -1; for(int j = 0; j < 60; j++){ if(N & (1ll<<j)){ if(mi == -1) mi = j; else if(mi2 == -1) mi2 = j; } } if(mi2 == -1){ cout << -1 << "\n"; continue; } else{ cout << (1ll<<mi2) - (1ll<<mi) << "\n"; continue; } } }