結果
| 問題 | No.3088 XOR = SUM | 
| コンテスト | |
| ユーザー |  SnowBeenDiding | 
| 提出日時 | 2025-04-04 22:58:53 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 852 bytes | 
| コンパイル時間 | 5,964 ms | 
| コンパイル使用メモリ | 332,048 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-04-04 22:59:08 | 
| 合計ジャッジ時間 | 13,206 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | AC * 2 WA * 20 | 
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;
        if (n == 0) {
            cout << "0 0\n";
            continue;
        }
        ll a = 0, b = 0;
        int p = 0;
        rep(i, 0, 62) {
            if (n & (1LL << i)) {
                p = i;
            }
        }
        ll m = 1LL << p;
        a = m;
        b = n ^ m;
        if (p >= 1) {
            ll na = 1LL << (p - 1);
            ll nb = na - 1;
            if (a * b < na * nb) {
                a = na;
                b = nb;
            }
        }
        cout << a << ' ' << b << '\n';
    }
}
            
            
            
        