結果
問題 |
No.3276 Make Smaller Popcount
|
ユーザー |
![]() |
提出日時 | 2025-09-19 22:33:34 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 400 ms / 2,000 ms |
コード長 | 646 bytes |
コンパイル時間 | 2,694 ms |
コンパイル使用メモリ | 278,548 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-19 22:34:31 |
合計ジャッジ時間 | 15,400 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--) { ll N; cin >> N; if(__builtin_popcountll(N) == 1) { cout << -1 << endl; }else { vector<int> b; for(int i = 0; i < 30; i++) { if((N >> i) & 1) b.push_back(i); } cout << (1 << b[1]) - (1 << b[0]) << endl; } } }