結果
| 問題 | No.3088 XOR = SUM | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-04-04 23:03:41 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 111 ms / 2,000 ms | 
| コード長 | 629 bytes | 
| コンパイル時間 | 5,591 ms | 
| コンパイル使用メモリ | 249,944 KB | 
| 実行使用メモリ | 5,888 KB | 
| 最終ジャッジ日時 | 2025-04-04 23:04:00 | 
| 合計ジャッジ時間 | 18,006 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 22 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--){
        ll n;
        cin >> n;
        if(n == 0){
            cout << "0 0\n";
            continue;
        }
        __int128 mx = 0;
        ll x1 = 1ll << __lg(n), y1 = n - x1;
        n = (1ll << __lg(n)) - 1;
        ll x2 = 1ll << __lg(n), y2 = n - x2;
        if(__int128(x1) * y1 > __int128(x2) * y2){
            cout << x1 << ' ' << y1 << '\n';
        }else{
            cout << x2 << ' ' << y2 << '\n';
        }
    }
}
            
            
            
        