結果

問題 No.3088 XOR = SUM
コンテスト
ユーザー t98slider
提出日時 2025-04-04 23:03:41
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 43 ms / 2,000 ms
+ 603µs
コード長 629 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,572 ms
コンパイル使用メモリ 276,688 KB
実行使用メモリ 9,868 KB
最終ジャッジ日時 2026-11-07 20:30:14
合計ジャッジ時間 17,916 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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';
        }
    }
}
0