結果
| 問題 | No.3624 Product |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 21:43:23 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 2,000 ms |
| + 470µs | |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 1,772 ms |
| コンパイル使用メモリ | 333,996 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-14 21:43:28 |
| 合計ジャッジ時間 | 4,004 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void){
int t;
cin>>t;
while(t--){
long long l,r;
cin>>l>>r;
if(l==r&&l==0){
cout<<0<<endl;
continue;
}
for(long long i=30;i>=0;i--){
if(r&(1<<i)){
if(l&(1<<i)){
cout<<-1<<endl;
}else{
cout<<(1LL<<i)*((1LL<<i)-1)<<endl;
}
break;
}
}
}
return 0;
}