結果

問題 No.3624 Product
コンテスト
ユーザー askr58
提出日時 2026-08-14 21:36:35
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 84 ms / 2,000 ms
+ 107µs
コード長 1,908 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,197 ms
コンパイル使用メモリ 263,844 KB
実行使用メモリ 9,336 KB
最終ジャッジ日時 2026-08-14 21:36:40
合計ジャッジ時間 4,632 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <ranges>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;

#include <atcoder/all>
using mint=atcoder::modint998244353;

ostream& operator<<(ostream& os,mint& x){
	os<<x.val();
	return os;
}
istream& operator>>(istream& is,mint& x){
	int t;
	is>>t;
	x=t;
	return is;
}

template <typename S,typename T>
ostream& operator<<(ostream& os,const pair<S,T>& p);
template <typename S,typename T>
istream& operator>>(istream& is,pair<S,T>& p);
template <typename T,size_t n>
ostream& operator<<(ostream& os,const array<T,n>& arr);
template <typename T,size_t n>
istream& operator>>(istream& is,array<T,n>& arr);
template <typename T>
ostream& operator<<(ostream& os,const vector<T>& vec);
template <typename T>
istream& operator>>(istream& is,vector<T>& vec);

template <typename S,typename T>
ostream& operator<<(ostream& os,pair<S,T>& p){
	os<<p.first<<" "<<p.second;
	return os;
}
template <typename S,typename T>
istream& operator>>(istream& is,pair<S,T>& p){
	is>>p.first>>p.second;
	return is;
}

template <typename T,size_t n>
ostream& operator<<(ostream& os,array<T,n>& arr){
	for(int i=0;i<n;i++)os<<arr[i]<<(i+1==n?"":" ");
	return os;
}
template <typename T,size_t n>
istream& operator>>(istream& is,array<T,n>& arr){
	for(int i=0;i<n;i++)is>>arr[i];
	return is;
}
template <typename T>
ostream& operator<<(ostream& os,vector<T>& vec){
	for(int i=0;i<vec.size();i++)os<<vec[i]<<(i+1==vec.size()?"":" ");
	return os;
}
template <typename T>
istream& operator>>(istream& is,vector<T>& vec){
	for(int i=0;i<vec.size();i++)is>>vec[i];
	return is;
}
#include <map>
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	int ttt;
	cin>>ttt;
	while(ttt--){
		ll l,r;
		cin>>l>>r;
		ll ans=-1;
		if(l==0)ans=0;
		for(int i=0;i<30;i++){
			ll b=(1<<i);
			if(b>r)continue;
			ll a=b-1;
			if(a>=l)ans=max(ans,a*b);
		}
		cout<<ans<<endl;
	}
}
		
0