結果
| 問題 |
No.3088 XOR = SUM
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-04 22:27:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 993 ms / 2,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 6,787 ms |
| コンパイル使用メモリ | 399,676 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-04-04 22:27:57 |
| 合計ジャッジ時間 | 36,964 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using cint = boost::multiprecision::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
void solve() {
ll n;
cin >> n;
if (n == 0) {
cout << "0 0\n";
return;
}
cint x = 0, y = 0, mx = -1;
rep(i, 100) {
cint nowx = 1ll << i, nowy = min(n - nowx, nowx - 1);
if (n < nowx)
break;
cint now = nowx * nowy;
if (mx < now) {
mx = now, x = nowx, y = nowy;
}
}
cout << x << ' ' << y << '\n';
}
int main() {
std::cin.tie(nullptr);
std::ios_base::sync_with_stdio(false);
int T = 1;
cin >> T;
for (int t = 0; t < T; t++) {
solve();
}
return 0;
}