結果
| 問題 | No.3624 Product |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 21:43:55 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 2,000 ms |
| + 665µs | |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 1,776 ms |
| コンパイル使用メモリ | 333,364 KB |
| 実行使用メモリ | 9,408 KB |
| 最終ジャッジ日時 | 2026-08-14 21:44:07 |
| 合計ジャッジ時間 | 2,991 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while(T--){
int l, r;
cin >> l >> r;
if(r == 0){
cout << "0\n";
continue;
}
if(l != 0 && __lg(l) == __lg(r)){
cout << "-1\n";
continue;
}
int b = 1 << __lg(r);
cout << (long long)(b) * (b - 1) << '\n';
}
}