結果
問題 |
No.1450 nahco314's First Problem
|
ユーザー |
|
提出日時 | 2021-03-14 20:29:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 395 bytes |
コンパイル時間 | 1,659 ms |
コンパイル使用メモリ | 166,036 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2024-11-08 14:10:43 |
合計ジャッジ時間 | 5,525 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 TLE * 1 -- * 33 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; int main(){ ll X; cin>>X; if(__builtin_popcountll(X^1)==1){ cout<<(X^1)<<endl; return 0; } if(__builtin_popcountll(X^2)==2){ cout<<(X^2)<<endl; return 0; } for(int M=1,two=1;two<=X;M++,two*=2){ if(__builtin_popcountll(X^M)==M){ cout<<(X^M)<<endl; return 0; } } cout<<-1<<endl; }